#include <unistd.h> #include <fcntl.h> #include <sys/types.h> int main() { int file=0; if((file=open("testfile.txt",O_RDONLY)) < -1) return 1; char buffer[19]; if(read(file,buffer,19) != 19) return 1; printf("%s\n",buffer); if(lseek(file,10,SEEK_SET) < 0) return 1; if(read(file,buffer,19) != 19) return 1; printf("%s\n",buffer); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter