Help is needed to read text from a file
I have been given a text file full of text pattern as shown below:
# VIEW OBJFILE = iiomsview16.V
# TYPE CNAME FBNAME COUNT FLAG SIZE NULL VALUE
# ----- -------- --------- ----- ---- ---- ----------
string hd_cd1 HEADER_CD 1 - 13 " "
string hd_text HEADER_TEXT 1 - 41 " "
I need to read this text file content and put into a customized ADT. One of the rules while reading from this file is that when a line started with a '#' character, the line is treated as comment and ignored.
My plan is:
Using fgetc() function to read in the characters from the file one by one;
My question is:
How do I detect end of a line or a "tab" character or the end of the file? They are NOT written in the ASNII chart, I think.
Can anyone help me please?