I came across the following code:
char buf[100]; char buf2[100]; strcpy( buf, "áéíóúç" ); sprintf(buf2, "%s", buf);
And I was wondering if it is right or not. I tested it on Windows and Linux, and it really worked, but will it work on all OS / platforms of different languages?
Both strcpy and sprintf expect the C string to end with a null character, but can the contents of the C string be anything (except for the null character)?
Is it possible to do something like:
strcpy( buf, "\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00" ); sprintf(buf2, "%s", buf);
?
source share