home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

how does C/C++ handle files?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2424
Discussions: 200,941, Posts: 2,379,267, Members: 246,304
Old January 13th, 2003, 10:25 AM   Digg it!   #1 (permalink)
PCLinuxOS 2009.1
 
dunbar's Avatar
 
Join Date: Feb 2001
Posts: 3,589
Blog Entries: 5
Send a message via ICQ to dunbar
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?
dunbar is offline   Reply With Quote
Old January 23rd, 2003, 09:26 AM     #2 (permalink)
PCLinuxOS 2009.1
 
dunbar's Avatar
 
Join Date: Feb 2001
Posts: 3,589
Blog Entries: 5
Send a message via ICQ to dunbar
bump - C++ must have file manipulation commands, people......
dunbar is offline   Reply With Quote
Old January 23rd, 2003, 09:49 AM     #3 (permalink)
Space for Sale! :p
 
eagle1's Avatar
 
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!
eagle1 is offline   Reply With Quote
Old 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.
Martee is offline   Reply With Quote
Old January 23rd, 2003, 01:22 PM     #5 (permalink)
Space for Sale! :p
 
eagle1's Avatar
 
Join Date: Oct 2001
Location: La Isla del Encanto
Posts: 5,836
BTW,.. yeah to what Martee said!
eagle1 is offline   Reply With Quote
Old January 24th, 2003, 09:57 AM     #6 (permalink)
PCLinuxOS 2009.1
 
dunbar's Avatar
 
Join Date: Feb 2001
Posts: 3,589
Blog Entries: 5
Send a message via ICQ to dunbar
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.
dunbar is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2912)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Wireless Televisions. (8)
California Passes Anti-Flat-HDTV Le.. (43)
Regular Build (6)
Obama the Muslim (14)
Is the PSU I received dead? (11)
windows vista security holes (9)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
Print spooler problem (13)
Foreign voltage (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Recent Discussions
sms storage to PC (0)
Regular Build (6)
Open With ..... Win7 (0)
java code for fibonacci (1)
screen resolution vs monitor size (0)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (35)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Partition Magic caused HDD problem (3)
Is the PSU I received dead? (11)
Have you switched yet? (85)
Point and Shoot Camera Suggestions. (2)
Modern Warfare 2 freeze (13)
Wireless Televisions. (8)
wireless user (1)
World's largest Monopoly Game using G.. (332)
Ideal cheap graph card for PC-Gaming? (17)
BIOS won't read disk when I try to fl.. (0)
Install XP pro and a Vista laptop ?? (11)
Graphics Card Upgrade Question (1)
favorit (1)
solutions for virtical white lines on.. (1)
Fire in DVD (2)
Modern Warfare For the PC (33)
radeon x850xt platinum & shader 3 (3)


All times are GMT -4. The time now is 01:56 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28