G
Guest
I had this:
fx_filepath = new TCHAR[path_length];
after copying and reading some string from file into fx_filepath, when I
called:
fprintf(stdout, "%s\n", fx_filepath);
I ended up with 5 random (altough always the same) characters appended to
fx_filepath.
What is more strange, fx_filepath is a member of a class and only the first
object created had this 5 characters appended, although subsequent objects
had exactly the same data fed into fx_filepath (and path_length was of
course the same in all objects).
memset(fx_filepath, '\0', path_length);
seems to do the trick, but I've never knew this is necessery. Is it?
fx_filepath = new TCHAR[path_length];
after copying and reading some string from file into fx_filepath, when I
called:
fprintf(stdout, "%s\n", fx_filepath);
I ended up with 5 random (altough always the same) characters appended to
fx_filepath.
What is more strange, fx_filepath is a member of a class and only the first
object created had this 5 characters appended, although subsequent objects
had exactly the same data fed into fx_filepath (and path_length was of
course the same in all objects).
memset(fx_filepath, '\0', path_length);
seems to do the trick, but I've never knew this is necessery. Is it?