I am a novice C programmer and I am having trouble understanding how to read a line in from a file and capture only part of the line into a variable. Could someone out there please show me how this can be done.
Thanks so much!
-Linda
I am a novice C programmer and I am having trouble understanding how to read a line in from a file and capture only part of the line into a variable. Could someone out there please show me how this can be done.
Thanks so much!
-Linda
There are various ways, depending on your data, and how you want to handle it. I'd suggest you research:
fopen()
fgets()
fgetc()
fread()
fclose()
and if your desperate:
fscanf().
Once you have data in memory, you can slice and dice with various string utilities.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]