aidanjt (and others obv
)
because the regex library was hard to control and I seemed to only be able to get hold of the older library etc it kept on throwing up errors, so having spent a good few hours on the problem I went to see my supervisor, who commented I could read in the buffer to a string (which then i decided should be an array, so more lines could be stored).
This is what I've got so far
Code:
FILE *fp;
int m;
m=0;
fp = fopen(fileload, "r");
...
while( fgets(buffer, sizeof(buffer), fp) != NULL )
fputs(buffer, stdout);
if (buffer[0]='|')
{
sprintf(buffer,data);
data1[m]=data;
m++;
}
else
fputs(buffer, stdout);
fclose(fp);
}
fputs(buffer, stdout); just puts it out onto the screen
but i was hoping my if statement if (buffer[0]='|') would find the first character and read that line (until it encounters \n ) and save it to the string, which I then put into an array.
Any help or pointers [no geeky pun intended]
Cheers