-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Check the number of lines in file to confront with the maximum defined of macro definition.
The following approach can be investigated further
int countLines(int *lineNum, char *filename)
{
char cmd[512];
sprintf(cmd,"wc -l < %s", filename);
FILE *pipe = popen(cmd,"r");
if(pipe == NULL) {
perror("popen failed");
return 1;
}
if(!(fscanf(pipe,"%d",lineNum))){
perror("fscanf failed");
pclose(pipe);
return 1;
}
pclose(pipe);
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels