Computer Science Canada Add extension to a file |
Author: | Scholar [ Mon Jul 07, 2014 7:37 pm ] | ||
Post subject: | Add extension to a file | ||
So basically I want to do something similar to:
Where current file is a certain .txt file containing co-ordinates for my game, I just want to add the .saved_game extension to the text file so LPSTR new_file = all the above ^^ How would I do this since my g++ compiler isn't liking the type of strings im using. It just crashes here and says that there is a stack error on strcpy()? note current_file & new_file are LONG * string -> LPSTR How could I do this? Add .saved_game extension to the current_file? |
Author: | Insectoid [ Mon Jul 07, 2014 9:24 pm ] |
Post subject: | RE:Add extension to a file |
Quote: note current_file & new_file are LONG * string -> LPSTR
Does strcpy take that type as input? |
Author: | Scholar [ Mon Jul 07, 2014 10:21 pm ] |
Post subject: | RE:Add extension to a file |
Yes sir, but don't tell me "the pre-defined parameters are char* ". I know this, if you could give me some way I can get around that or some alternative that would be much appreciated. I haven't really tried anything else so I couldn't tell you anything more. But please, if you will, some "bypass" would be greatly appreciated. |
Author: | Dreadnought [ Mon Jul 07, 2014 10:48 pm ] |
Post subject: | Re: Add extension to a file |
You might be looking for wcstombs (converts wide-character strings to multi-byte character strings). |
Author: | Scholar [ Mon Jul 07, 2014 11:48 pm ] |
Post subject: | RE:Add extension to a file |
Isn't this the same as just passing the platform encoding as multi-byte characters in the project settings which I already have it set. Doesn't that eliminate the need for this function? |