all in wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio
Many examples come from either Beginning Linux Programming by Neil Matthew and Richard Stones Or from Dr. Robert Siegfried
| write to screen using write | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/simple_write.c |
| write to file using write | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/simple_write_file.c |
| read from screen using read and write the buffer back | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/simple_read.c |
| copy one file to another by character - no fixed layout | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/copy_system.c |
| copy one file to another by block - no fixed layout | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/copy_block.c |
| just creates one file using open - no fixed layout | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/create_file.c |
| opens many files and looks at their descriptors | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/create_file_many.c |
| set and get environment variable; use it to open file; use program arguments (argv) array to open file; |
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demoenvfile2.c wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/envsetscript wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demoenvget.c |
| read an input file line by line |
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demoreadline.c to contrast reading a whole chunk at a time: wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demoreadlinechunk.c |
| demonstrates writing and reading a fixed layout file using a structure |
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demoenvfile3.c
|
| demo write a new file without matches |
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demoremovefixed.c wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demoremovenonfixed.c |
| link and unlink files - which renamed a file |
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/demorename.c
|
| show hex values of a file | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/hexdump.c |
| write one character far from the file start | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/lseek_huge.c |
| demonstrate file locking | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/lockdemo.c |
| demo malloc | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/menuWMalloc.c |
| make a menu | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/menuwork.c |
| read directories | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/readdirectory.c |
| read a file | wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/readfile.c |
| write a file with and without using seek; append to a text file - no fixed layout |
wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/timestamp.c wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/timestampwithseek.c |