DiamondLightSource / DiamondLightSource/ppmac_read_csv

Check Number of lines

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

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;
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.