So I've got some code and I'm trying to construct a string which contains a path to file that I will later open. When I originally wrote the code I was using Cygwin and GCC and it worked great. No issues. But then I moved to MinGW as the needs for my code changed, and now my sprintf() causes seg faults, not sure why.
I've done some searching on the net and found that apparently MinGW has alternative functions for safer use...? One was snprintf(), which I called (I believe correctly) and it didn't seg fault but it also didn't produce the correct results. Again, not sure why. Does anyone have any insight into why this might not be working or can anyone explain any issues with strings and their associated functions with MinGW?
Here's my code:
/*Earlier in code*/
char TPath = "D:\\Projects\\";
snprintf(buf, 6, "%0*5d", xRangekm);