Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5355

remove function - Access denied

$
0
0

hi,

I try to delete a file after constructing the file name based on info passed into the function.  it fails.  in debug mode, I can see that the file name is correct.  I narrow the problem down to this:

 

if I use a local char this way:

 

char *ThisFile = "C:\Inetpub\ftproot\Saved Settings\zz.txt";

int status = remove (ThisFile); 

 

The content of ThisFile is corrupt as shown in the picture - file 1.  But if I use it this way:

 

char *ThisFile = "C:\\Inetpub\\ftproot\\Saved Settings\\zz.txt";

int status = remove (ThisFile); 

 

It succeeds, but the content of ThisFile changes, as shown in the picture - file 2.

 

Problem: I pass the Folder Name into the function as a string, whose value is seen as:

 

C:\Inetpub\ftproot\Saved Settings\

Then I construct the file name from it.  It fails all the time.  The removal of the '\' character is to blame, as the local method works with the '\\' in place.  What can I do in this case?  I do not encounter this problem with remove() function.  Other functions like fgetc() and fopen() do not give me this problem.  Please help.


Viewing all articles
Browse latest Browse all 5355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>