Hello everyone, new user here and not a frequent user of C so please don't be harsh at me :P
What I'm trying to do is read some data from a txt file, like these:
XX10X11110100X0011111XX1011101X101111XX1X1X1111X11X110111110XX11,000
010101100XX1110000110X00110111100010XX001101101X1011X10XX0X0XX01,001
and copy them to 2 string arrays. The first array's first string shall be
XX10X11110100X0011111XX1011101X101111XX1X1X1111X11X110111110XX11
and the second one's respectively:
000
This is my code:
intro = fopen("file.txt","r");
while (fgets(buffer,sizeof(buffer),intro)!=NULL)
{
sscanf(buffer, "%[^,]%[^\n]", HuffOriginal[i], HuffSymbol[i]); //I need to avoid commas here
printf("\nOriginal %d:%s\nSymbolic %d:%s\n", i, HuffOriginal[i], i, HuffSymbol[i]);
i++;
}
fclose(intro);
The output is:
Original 0: XX10X11110100X0011111XX1011101X101111XX1X1X1111X11X110111110XX11 (which is good)
Symbolic 0: ,000 (which isn't!)
I'd appreciate any advice. Thank you in advance!