Thanx for the code and samples
Sorry im not so familiar with the code, could you please explain more detail
? uint32_t // whats this for type an unsigned int 32bits where does the _t stand for
? f->seek(0)[; // resetting pointer??
while ((n = f->read(buf, sizeof(buf))) > 0) //read a buffer in sequence of size buf, if n=0 no characters any more
{
for (int i = 0; i < n; i++) // check in a loop is one of the characters is a end of line
{
if (buf == '\n') nl++;
- }*
- }*
What will happon if there are lines with no characters, so only a '\n' ,will that be detected as EOF or is n = 1 in this case
n=0 when EOF is detected?
About the buf size, how larger the buffer how faster the file is read
but using a buffer of size 1 , will result in a read time of 0.32sec
So a buffer of 30 is really fast 0.053sec
i though in a direction of this code
File fh;
char ch;
int lineNo;
int chPos;
while (fh.available() && ch!= 'EOF' && chpos <30)
{
-
ch = fh.read(); //read character*
-
if (ch != '\n')*
-
{*
-
chPos++;*
-
}*
-
else*
-
{ *
-
lineNo++;*
-
chPos = 0;*
-
}*
*} *