The code is like this:
int fd = open(filename, O_RDONLY);
"max open files" is 1024. The process may opened hundreds of files. At the beginning, it works good. After a while, open returns 0. I don't know why. Help!!! Thanks advance!
ps: It's not int fd = open(filename, O_RDONLY) == -1;
When open returns 0, it's telling you that you should use fd 0 if you want to use the file you just opened.
Did you perchance close stdin?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With