with strlen () it does not work, and I suppose that a space is counted as a character, so it forced me to subtract the number of space ...
Code:
/ * Read the file to find the number of lines * /
while (fgets (string, max_size, file)! = NULL)
/ * Fgets () reads a string until the newline * /
nl + +; / * on the number of newline * /
printf ( "row =% i \ n", nl);
/ * Read the file to find the number of columns * /
rewind (file);
while ((nc = getc (file))! = '\ n')
if (nc! = '') nc + +;
printf ( "column =% i \ n", nc);
Bookmarks