T
Tony Clarke
Hi All,
I have been trying to extract data from a text file using the fscanf()
functions and sscanf() functions. The file is of various characters and
integers separated by semicolons, the problem I'm having is that each line
is of varying length and the fields separated by semicolons are of varying
length also. Is there a way that I could check the first field and depending
on this extract data from certain fields contained in this line. An example
of the type of information in the text file is given below. What I want to
do is depending on the first field i.e. "1031" extract the time i.e.
"15:09:27" or some other details. I'm just wondering if anyone could suggest
an appropriate method for approaching this. I think the problem is that each
line is not formatted the same.
1031;00005882;admin;5;Printer;2;103001-;STD;Lodg
;12.06.2003;15:09:27;13.06.2003;08:30:31;1;1
1032;00005882;;;;;;;
1040;00005882;12.06.2003;15:09:33;12.06.2003;17:01:21;1;0;;3;12400;0;;;12400
;0;0;;11366
1041;00005882;1;1
I have been trying to extract data from a text file using the fscanf()
functions and sscanf() functions. The file is of various characters and
integers separated by semicolons, the problem I'm having is that each line
is of varying length and the fields separated by semicolons are of varying
length also. Is there a way that I could check the first field and depending
on this extract data from certain fields contained in this line. An example
of the type of information in the text file is given below. What I want to
do is depending on the first field i.e. "1031" extract the time i.e.
"15:09:27" or some other details. I'm just wondering if anyone could suggest
an appropriate method for approaching this. I think the problem is that each
line is not formatted the same.
1031;00005882;admin;5;Printer;2;103001-;STD;Lodg
;12.06.2003;15:09:27;13.06.2003;08:30:31;1;1
1032;00005882;;;;;;;
1040;00005882;12.06.2003;15:09:33;12.06.2003;17:01:21;1;0;;3;12400;0;;;12400
;0;0;;11366
1041;00005882;1;1