|
-
July 22nd, 2003, 10:00 PM
#1
sprintf behaveing strangely
Getting strange sprintf results and hopeing someone here can help. The optional argument is somehow being writen to.
By definition sprintf is suposed to take the format string, optional data, and write it into the output buffer.
sprintf(outbuf, formatstring, opt1, opt2...);
This is for an uninstaller, after the program uninstals the uninstaller deletes itself. Not a lame virus.
So say:
char ThisFile[] = "C:\Program Files\Blah\file.exe";
I want a sequence of formated strings:
char TempString[2][500]; // array of strings
sprintf(TempString[1], "del \"%s\"\r\n", ThisFile);
TempString[1] is as expectd, and ThisFile still equals the same
Now another sprintf:
sprintf(TempString[2], "if exist \"%s\" goto TryAgain\r\n", ThisFile);
This is now my problem, it apers both TempString[2] and ThisFile were writen to
TempString[2] == ThisFile =
if exist "" then goto TryAgain
How can ThisFile be writen to, the optional arguments are to be left along corect?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|