AD4513 DS4552 FD3333 FG5564 ect...,
all fifty codes are in one line seperated by one space. I wrote this short program to check if I was correctly reading the file into the array so I had the program output to what was in element 0 of the array. Instead of having just one 6 character code in it, it seems to read the entire line of 50 codes into one element. Can anyone tell me what I am doing wrong? I can't figure out how to read one code at a time into the array. How do I get the program to stop when it gets to a space and then read the next code it reads into a new element of the array? From what I can see, I my code reads the entire file as one continous code. Thanks for any suggestions.
printf("The file could not be opened.
fscanf(fptr, "%s", &pcodes[i]); /* reads file into string array */
}/* end while */
printf("This is pcode0 %s
It looks like you're new here. If you want to get involved, click one of these buttons!