[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
question on reading ascii data from a file.
From: |
address@hidden |
Subject: |
question on reading ascii data from a file. |
Date: |
Thu, 25 Oct 2012 13:16:47 +0200 |
Dear listmembers,
I have a (probably ...) simple question. When reading data from a file (say,
two columns of numbers), the fastest way to access the data to do a
infile=fopen("name", "r");
data=fscanf(infile, "%f %f");
fclose(infile);
however, doing this you cannot cope with lines having a different shape and /
or being comments. To circumvent this problem, I started reading line by line,
removing whitespace from the front of the line and check wheter the first non
whitespace character of the line is a %, a ;, a # or a similar character. This
actually works, however, it is very slow.
Does someone of you probably have an idea how to handle this (improve speed)?
Thank you very much in advance,
take care
Dieter Jurzitza
- question on reading ascii data from a file.,
address@hidden <=