Re: Need Help: C++ Delete Known File
From: Dave Townsend (datownsend_at_comcast.net)
Date: 05/11/04
- Next message: Andrew Brampton: "Re: Efficent use of the string class"
- Previous message: John Harrison: "Re: read/parse flat file / performance / boost::tokenizer"
- In reply to: da Vinci: "Need Help: C++ Delete Known File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 11 May 2004 13:55:22 -0700
Without reading through the entire thread, I suspect
the problem is you are not in the correct directory
to remove the file - if you are running your program
in VC++, the program is actually run in the debug or release
directory under your project - please check that or
put the file you want to delete in the debug/release directory
and try that.
Hope that helps!
dave
"da Vinci" <blank@blank.com> wrote in message
news:fh3r90l14s2f4qkl7mjhroc5l0c3k9iffc@4ax.com...
> Greetings,
>
> Onwards with the school studying.
>
> Working on a program and need to delete a file from a known location
> on the hard drive but cannot get anything I do to work.
>
> I have tried to use the remove function that is included with <cstdio>
> but cannot get it to work properly. My reference book has the
> following....
>
> int remove(const char *fname);
>
> and I have found information on the internet using the same above
> along with an if statement. When it returns -1 it prints out "Not
> deleted" and when it returns 0 if prints "deleted".
>
> However, it never deletes the file.
>
> I have tried to use the system("del c:\deleteme.txt"); command as
> well. When I have tweaked the above command, it continues to say the
> file doesnt exist even though the path it shows is EXACTLY where the
> file is.
>
> I hate asking for code, in fact I think there is something in the FAQ
> saying not to ask for it.... but can someone set me straight here.
> Either I cannot figure out how to use the remove() properly or
> something is afu. :)
>
> Thanks gents.
- Next message: Andrew Brampton: "Re: Efficent use of the string class"
- Previous message: John Harrison: "Re: read/parse flat file / performance / boost::tokenizer"
- In reply to: da Vinci: "Need Help: C++ Delete Known File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|