/*

 * http://sosal.kr/

 * made by so_Sal

 */

 

 The programming of  Basic  file system-call.

1st 
Input file name, and make file.
Save the content written by user in the file.
If user enter the buffer “The end”, then end the program.

2nd

Input  2 files name, and make file1, file2.
Save the content written by user in the file.
If user enter the buffer “The end”, then end the program.
Append the content on the file2.
Repeat 1-4 level.  ( quit  option added in level1.) 

 


- Assignment 1.


 


The source code of program.

fcntl.h : Header file 
                  To use file system call.

Open( buffer, O_WRONLY | O_CREAT, 00644);

File name: contents of ‘buffer’.

FD attribute:  O_WRONLY,O_CREAT
only writing mode.
unless file exists, make the new file.

Permission:  r w - | r - - |  r - -

write( fd,  buffer, strlen(buffer));

Write contents of the buffer on the file which 'fd' point 

 

 

 

Assignment 2



 

Source code, and annotation.

Rewind : return FD to fisrt side of file

Memset : Initialize the buffer.

 




Posted by sosal sosal

댓글을 달아 주세요