Re: Need Help: C++ Delete Known File

From: Dave Townsend (datownsend_at_comcast.net)
Date: 05/11/04


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.



Relevant Pages

  • Re: More station photography woes (& police searching)
    ... > suspect, especially if I was the first of a raid team going in. ... > radio and proved it when he drove from Reading to Slough at 3am to try and ... It is the guy I'm thinking of, he used to phone the TVS Reading office with ... info he'd got from listening in to Police radio and then try and get money ...
    (uk.railway)
  • Re: the maximalistic position (Was: Children and Observance/Davening)
    ... >>And I don't know where you learned that the default reading of a text ... It's not my personal view (which, I suspect, is even more naturalistic than ... And these amoraim attributed a sinaitic origin to their teachings ...
    (soc.culture.jewish.moderated)
  • Re: More station photography woes (& police searching)
    ... suspect, especially if I was the first of a raid team going in. ... As for the photographer he's still around, ... and proved it when he drove from Reading to Slough at 3am to try and ...
    (uk.railway)
  • Re: word 2002 normal.dot
    ... Suzanne's replies requesting additional information from a poster in ... reading approximately 15,000 posts she has made to the newsgroups from ... When you're done I suspect you will gladly return and make a public ... apology to one of the most dedicated MVPs I know. ...
    (microsoft.public.word.application.errors)
  • Re: Using add-ins in excel 2007
    ... You must save the Addin in the correct directory: ... I suspect that Charles doesn't have a Microsoft Office 2004 directory, ...
    (microsoft.public.mac.office.excel)