Quote:
Originally Posted by
aarathy
hello all,
i'm a beginner in linux programming. I need to know what is the difference between system calls and normal functions like fopen, fread etc in C?Also how to set permissions by using open system call?
System calls are fundamental, there's no deeper to go. Trace it with a debugger and you can't trace inside open(), because the program doesn't
run open -- just tells the kernel to do so. The kernel just stops the program until it's finished.
fopen/fread/fclose are all just library functions inside libc. If they were built with debugging info, you could trace them. In the end, they use open/read/close like anything else which does file I/O.
To give permissions to open, you do open("filename", O_RDWR, 0666); where 0666 are octal permissions just like UNIX file attributes. They only matter when creating the file.