im just trying to open a file. i have done it for 100 times, and then I sent SIGCHLD signal to other processes and i think right after that i couldn't open that file anymore.
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#define FLAGS IPC_CREAT | 0644
int main() {
int res =open("results.txt",FLAGS);
if(res== -1) { printf("error!!")} //prints it every time
return 0;}
..it suddenly just happened.. help ???
You're doing something strange with the flags. I think your intention is as per below code:
#define FLAGS O_CREAT
#define MODE 0644
int main()
{
int res =open("results.txt",FLAGS,MODE);
if(res== -1) { printf("error!!");} //prints it every time
return 0;
}