how does C/C++ handle files?  | |
January 13th, 2003, 10:25 AM
|
#1 (permalink)
| | PCLinuxOS 2009.1
Join Date: Feb 2001
Posts: 3,589
| how does C/C++ handle files?
I'm not a coder. I once wrote code under Borlands TurboBasic, so I am familiar with the concept of command strings.
I'm looking to search through Linux source code for commands that open and write to files (I'll be using grep to pattern match).
Because many distros decide to place files in different locations despite standards, because distros decide to remove /usr/docs, and even ubiquitous man pages do not always tell you where config files are stored. Whether reading a script created file or writing its own file, each Linux package which needs a config file has to either read from or write to the config file, via some command. I need to search for the instructions which open files, and also search for instructions which save files. The source code needs to have the filenames somewhere in the source code. Usually adjacent to the command which oepns the file ore the command which writes the file.
Grepping is easy, but what are the file manipulation commands that I need to search for?
Or did I make one assumption too many? |
| |
January 23rd, 2003, 09:26 AM
|
#2 (permalink)
| | PCLinuxOS 2009.1
Join Date: Feb 2001
Posts: 3,589
|
bump - C++ must have file manipulation commands, people...... |
| |
January 23rd, 2003, 09:49 AM
|
#3 (permalink)
| | Space for Sale! :p
Join Date: Oct 2001 Location: La Isla del Encanto
Posts: 5,836
|
why C++?
Wouldn't it be better to use Perl Scripts to manipulate files?
(I think it's way easier!)
__________________
boo!
|
| |
January 23rd, 2003, 01:01 PM
|
#4 (permalink)
| | Member
Join Date: Feb 2002
Posts: 161
|
C++ file manipulation:
Classes - fstream, ifstream, ofstream;
Methods - getline(), write(), get(), overloaded operator << and >>
C file manipulation:
Structs - FILE.
Functions - fopen(), fread(), fwrite() fgetc(). fclose().
Also, open() and close() for manipulating file descriptors directly. |
| |
January 23rd, 2003, 01:22 PM
|
#5 (permalink)
| | Space for Sale! :p
Join Date: Oct 2001 Location: La Isla del Encanto
Posts: 5,836
|
BTW,.. yeah to what Martee said!  |
| |
January 24th, 2003, 09:57 AM
|
#6 (permalink)
| | PCLinuxOS 2009.1
Join Date: Feb 2001
Posts: 3,589
| Quote: Originally posted by Martee snipped | Excellent. I appreciate the reply, Martee.
The purpose of this request is for me, a Linux newbie, to be able to grep through Linux sourcecode, and discover the names of the config files for anything that gets configured - I've seen many man pages that do not list config files and thus the man page is just not very thorough (info pages were no better); I've also chosen to use a distro that removes /usr/doc sections as well. |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |