Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(pos != -1 && lineCount < 10)
- {
- if((rState = read(fileDesc, &c, 1)) < 0)
- {
- perror("read:");
- }
- else if(rState == 0) break;
- else
- {
- if(pos == -1)
- {
- pos = lseek(fileDesc, 0, SEEK_END);
- }
- pos--;
- pos=lseek(fileDesc, pos, SEEK_SET);
- if (c == '\n')
- {
- lineCount++;
- }
- charCount++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement