Can anyone tell me how to delete a file in the same folder as the .exe file?
Thanks for your help!
-KaibaFan321
Can anyone tell me how to delete a file in the same folder as the .exe file?
Thanks for your help!
-KaibaFan321
Tutorial on File I/O
[edit] It's Under Useful Functions [/edit]
Last edited by prog-bman; 07-09-2004 at 07:57 PM.
Woop?
Originally Posted by KaibaFan321Code:int main(int argc, char ** argv) { int error, status = 0; const char * errname = 0; while(*(++argv)) { printf("Deleting '%s'...", *argv); error = remove(*argv); if(error) { status = error; errname = "Failed"; } else { errname = "Success"; } printf("%s (%d).\n", errname, error); } return status; }
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
>>error = remove(*argv);
>>status = error;
>>return status;
A minor point, but be warned that you could be returning undefined values, as remove() will return non-zero on error.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]