Reputation: 4337
Is it possible to use mmap in C for reading textfiles ? I know its possible with binary files. But when I try to read an entire textfile I seem to be having some problems.
Upvotes: 0
Views: 156
Reputation: 662
You can use mmap on any file.
You should elaborate on your problems.
Upvotes: 0
Reputation: 318518
Yes, that works of course - "text files" are just a subset of "binary files" anyway.
However, don't expect a trailing \0
so you cannot use any string functions since they require NUL-terminated strings.
Upvotes: 2