Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テキストファイルを読み取るためにCでmmapを使用することは可能ですか? バイナリファイルで可能であることは知っています。しかし、テキストファイル全体を読み込もうとすると、いくつか問題があるようです。
はい、もちろん機能します。とにかく、「テキスト ファイル」は「バイナリ ファイル」のサブセットにすぎません。
\0ただし、 NUL で終了する文字列が必要なため、文字列関数を使用できないため、末尾を期待しないでください。
\0
どのファイルでも mmap を使用できます。
問題について詳しく説明する必要があります。