I want to do next: I have a huge file(over 4GB). I want to mmap it and then to take from this mmapped area buffers of 128 bytes. how can I do it? To mmap file I use this:
int fd = open(file_name, O_RDONLY);
void* addr = mmap(0, /*ULONG_MAX*/100000000, PROT_READ, MAP_SHARED, fd, 0);
After these strings I want to get described above buffers but I don't know how and I didn't find it in the web.
additional info: file_name is text file. it contains strings
UPD: I'll try to explain: I want to mmap file and then take from mmapped area 128 bytes(actually chars) and put it to some buffer. Now i use next code:
char buffer[128];
struct str* addr = mmap(0, /*ULONG_MAX*/128, PROT_READ, MAP_SHARED, fd, 0);
scanf((char*)addr, "%s", buffer);
printf("%s\n", buffer);
But it doesn't work. So I'm looking for the solution.