Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8575281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:39:29+00:00 2026-06-11T19:39:29+00:00

I am having a simple problem that I cannot find a simple solution to.

  • 0

I am having a simple problem that I cannot find a simple solution to. I am trying to delete a file permanently. I’m not looking for the fanciest way to make the data unrecoverable, I just don’t want it sitting in the Recycle Bin. I have two questions.

  1. Is the a way to get the path to the Recycle Bin? The idea is that once I have the path I can use remove() to delete it permanently from there. The following fails for me, returning a completely different path that isn’t that of the Recycle Bin. Maybe I am missing an argument.

    char RecycleBin[_MAX_PATH];   
    SHGetSpecialFolderPath(NULL, RecycleBin, CSIDL_BITBUCKET, FALSE);
    
  2. Is there a win32api call to permanently delete a file?

Thanks for reading.

EDIT 1:

Per the answer below, I have been using the _unlink () function but it’s behavior doesn’t do exactly what I want it to do. I need something to get the Desktop, then add a file to that string and pass the string into a function that will delete the file as an argument. Here is how I am trying with unlink.If I do unlink like this – it works:

     char path [] = "C:\\Users\\testuser\\Desktop\\test.dat";

     _unlink( path );

However, if I try it in the two following ways it fails.

    char DesktopPath[_MAX_PATH];

    SHGetSpecialFolderPath(NULL, DesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE);

    strcat ( DesktopPath, "\\test.dat" );

    _unlink ( DesktopPath );

This way (adding quotes) also fails.

    char DesktopPath[_MAX_PATH];

    char final_path [] = "\"";

    char quotes [] = "\"";

    SHGetSpecialFolderPath(NULL, DesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE);

    strcat ( DesktopPath, "\\test.dat" );

    strcat ( DesktopPath, quotes );

    strcat ( final_path, DesktopPath );

    _unlink ( final_path );

Both of the above ways compile and run fine, but it doesn’t actually get rid of the file. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:39:30+00:00Added an answer on June 11, 2026 at 7:39 pm

    Use the POSIX function unlink (_unlink for MSVC2005+).

    _unlink("file.ext"); //delete file without sending to Recycle Bin
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem that I believe has a simple solution. I'm writing a
I'm having a very simple problem. I'm new to WordPress and I'm trying to
I searched the site but I could not find any solution to this problem.
I am having a problem that is strange to me but hopefully is not
I am having the following problem that I cannot solve. Let's say I have
I am having one hell of a problem that I cannot figure out for
I am getting frustrated over a simple problem where I cannot find the issue:
hey guys having this really simple problem but cant seem to figure out have
I believe I'm having a relatively simple problem with a video player implementation in
I'm having a simple test design problem, which I would like to solve once

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.