int source = open("hi", O_CREAT | O_RDONLY);
int dest = open("resultfile", O_CREAT | O_RDWR | O_TRUNC);
FILE* source1 = fdopen(source, "r");
FILE* dest1 = fdopen(dest, "w+");
close(source);
close(dest);
fclose(source1);
fclose(dest1);
int sourcef = open("resultfile", O_RDONLY);
printf(strerror(errno));
I do not understand why? How can I successfully combine open-source IO with open ()?
The library I work in only accepts the integer fd (and the library is internally responsible for closing it, presumably with close ()), but I still need to work with the file, and I donโt see how this is possible without calling f ( ) like (fread (), ftell (), etc.)
source
share