Hi,
I am handling tab delimited txt files that have multiple fields. But some of the fields can be empty. So it will appear as <TAB><TAB> in the file rather than <TAB>something< TAB>. If I read in the line and then use something like
The program will skip these empty field and assign the value of the next non-empty field to the variable. What I really want it to do is to assign an empty string (length of 0) to the variable.
How can I write the sscan file to do the scanning? Of course, I can read the line character by character and check if anything is a <TAB> and turned the substring into a field value but that is a little awkard to my opinion. Any good and simple way to do this?
Thanks!
Shan
I am handling tab delimited txt files that have multiple fields. But some of the fields can be empty. So it will appear as <TAB><TAB> in the file rather than <TAB>something< TAB>. If I read in the line and then use something like
Code:
sscanf(buf0, "%s %ld %ld %s %s %s %s %s", chr, &bg, &ed, zg, var, ref, s1, s2);
How can I write the sscan file to do the scanning? Of course, I can read the line character by character and check if anything is a <TAB> and turned the substring into a field value but that is a little awkard to my opinion. Any good and simple way to do this?
Thanks!
Shan
Comment