I’m trying to open a binary file using system calls, I cannot use functions (fopen etc)
if ((fd2 = open("RandomStruct.bin",O_RDWR|O_CREAT)) == -1)
err_sys("Failed to open binary\n");
Is this line of code incorrect? thanks!
btw I get “: Error 0” O.o
No, it is not correct. If you specify the O_CREAT flag, then open() needs another argument, which is the permission bits for the new file. e.g.