In my basic Linux Programming course at college, we use fcntl.h and unistd.h Using C++ strings, I get the following:
statusOfFunction = write(fileDescriptor, input.c_str(), input.length());
This line works. I get a file created, with the contents of input string. But, why doesn't any of these lines work:
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
Here is the program, for your reference. Thank you! :)