c++ Pass quoted string as char array to a function -
so have function declared as:
void writefile (unsigned char *filename, unsigned char *data)
if call function this:
writefile("f.txt", "test1");
is fine.
if second call this:
writefile("s.txt", "test2\nline");
the filename fine, data corrupted (the first 5 bytes messed up).
if third call this:
writefile("f.txt", "test3\r\nline");
the filename corrupted, , data has it's first 5 bytes messed up.
what going on?
i believe problem has using unsigned chars, when put code complains on compile it. may have unsigned char not being able use escape characters \n
, can't sure.
intellisense: argument of type "const char *" incompatible parameter of type "unsigned char *"
is compile error get.
when changed being regular char *
parameters, worked fine.
Comments
Post a Comment