大学での私の基本的な Linux プログラミング コースでは、fcntl.h と unistd.h を使用します。C++ 文字列を使用すると、次の結果が得られます。
statusOfFunction = write(fileDescriptor, input.c_str(), input.length());
この行は機能します。入力文字列の内容を含むファイルが作成されます。しかし、なぜこれらの行のどれも機能しないのですか:
statusOfFunction = read(fileDescriptor, reading.c_str(), 10);
Error: No matching function call to "read"
statusOfFunction = read(fileDescriptor, reading, 10);
Error: No matching function call to "read"
statusOfFunction = read(fileDescriptor, &reading, 10);
No error throws up, but does not get executed
statusOfFunction = read(fileDescriptor, &reading.c_str(), 10);
Error: No matching function call to "read"
https://www.dropbox.com/s/lnw208uo3xurqxf/Basic%20Unix%20Operations%20on%20Text%20Files.cpp?dl=0
参考までにプログラムを載せておきます。ありがとうございました!:)