c - Why does open make my file descriptor 0? -


I am working on a program using a pipe and fork and ending in an output file But when I open a file the file descriptor is 0 which is usually a studin but I think that my problem is my reason is this is my code

  outputfd = Open ("file", O_RDWR | O_CREAT | O_TRUNC) == -1  

Can someone tell me why this 0 Land? Or how to fix it?

That's because you get it done -1 .

outputfd does not get the result of open . This is -1 .


Comments