Simply enough, i takes file_location, copies filename into it minus the filename, and then adds "../conf/sync.conf"Code:char* file_location = new char; strncat (file_location, filename, strlen(filename) - strlen(basename(filename))); strcat (file_location, "../conf/sync.conf"); file = new char; strcpy (file, file_location);
(filename is a string to the absolute path of the program being ran)
But, when the "file = new char;" is called, it cuts down the string file_location a lot, making the file sync.conf unopenable o_0;
Why is new on a variable killing a different one? o_0
Can I only have one new at a time.. or.. ? x_X
Thanks...
Funny, doing this in the malloc way works fine =(