char Path[256];
sprintf(Path, "GameFolders\\%s\\%s\\%s", str.Email, str.GameName, str.fileName);
remove((const char*)Path);
Struggling With Removing a File? (C++)
I must be forgetting something, but the remove function with "std" doesn't work for me. I have it working like so:
I'm using this function on Windows platform.
Do I need a "full length" path to that file for it to delete? I want to recreate a file in it's place, but I have to remove it first before I recreate it. :S
Thank you, sorry this question seems to be kinda low level for me, but I guest we all can't know or remember everything.
I believe the problem to be that std::remove has nothing to do with files. ;-)
If you're on Windows, use ::DeleteFile(path). If you're using boost, you can use boost::filesystem::remove(). but std::remove is for a completely different purpose.
If you're on Windows, use ::DeleteFile(path). If you're using boost, you can use boost::filesystem::remove(). but std::remove is for a completely different purpose.
Quote:Original post by cache_hit
I believe the problem to be that std::remove has nothing to do with files. ;-)
That's what I also thought at first, but...
I mean this remove function not the std then. hehe, I tried that as well and it returns false all the time. I'm guesting it's a value issue? Here is Path's
value = "GameFolders\Accounts\myEmail@yahoo.com\SomeGame\myGame.txt".
value = "GameFolders\Accounts\myEmail@yahoo.com\SomeGame\myGame.txt".
Quote:Original post by ajm113
it returns false
Precisely, it returns an integer. So it returns 0. That means success.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement