I'm having trouble understanding the result of this:
fscanf(FILE,"%s|%s", str1, str2);
printf("Number:%s, Name:%s", str1, str2);
Content of FILE:
01234|MY_NAME
Expected Output:
Number:01234, Name:My_NAME
Output:
Number:01234|MY_NAME, Name:╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠01234|MY_NAME
Can someone explain why it gives that output?
P/s: I've solved it with this code:
fscanf(FILE,"%[^|]|%[^|]", str1, str2);
printf("Number:%s, Name:%s", str1, str2);
But I still don't understand why "%s|%s" gives the previous output.