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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, that works of course – “text files” are just a subset of “binary files” anyway.
However, don’t expect a trailing
\0so you cannot use any string functions since they require NUL-terminated strings.