Thursday, July 30, 2009

How to access other system files from my C program in Linux platform?

that is i want to write the C program to access the other system file(read/write). how can i do that?


one thing is i should not use client/server technic

How to access other system files from my C program in Linux platform?
use the fopen( ), fgets( ) or fscanf( ), and fclose( ) functions.





if the program is in c++ there are some nicer to use libraries, but these will work in c
Reply:i love you
Reply:The standard C way to access files is through the stream I/O functions, such as fopen, fclose, fgetc, fputc, and friends. These represent I/O streams with FILE * objects.





On Linux, Unix, and most other platforms there is another set of I/o functions that you can use, which map more or less directly to the OS file operation calls: open, close, read, write, and friends. These represent files with file descriptors, which are small integers.





All of these functions should be documented in man(1) pages on your system. The first set, which are C library functions, are in Section 3 of the manual; the second set, which are C system call functions, are in Section 2.





I don't know what you mean by "client/server technic".


No comments:

Post a Comment