| | |
file processing, Random-access Files
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Mar 2007
Posts: 68
Reputation:
Solved Threads: 1
i am a newbie in C++ file processing...
Any1 can guide me to search for an item(lastname) in the example below?
what is seekg or seekp... how to use it?
Any1 can guide me to search for an item(lastname) in the example below?
what is seekg or seekp... how to use it?
C++ Syntax (Toggle Plain Text)
#include<iostream> #include<fstream> using namespace std; void main(){ char firstname[10], lastname[10]; int age; ofstream write("text.txt", ios::app);/*actually i am not sure what ios::app does*/ cout<<"firstname: "; cin.getline(firstname,sizeof(firstname)); cout<<"last name: "; cin.getline(lastname,sizeof(lastname)); cout<<"age: "; cin>>age; cin.ignore(); write<<firstname<<endl; write<<lastname<<endl; write<<age<<endl; }
Last edited by ~s.o.s~; Mar 19th, 2007 at 1:04 pm. Reason: Removed the weird coloring and fixed code tags, learn to use them.
Not a clue what you are asking. Maybe you need to explain the problem. Remember, we're new to it so details will help.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Read the links posted by me in the second post.
An eg.
An eg.
C++ Syntax (Toggle Plain Text)
string inStr; string searchFor = "hello"; ostream in ("test.txt"); while (getline (in, inStr)) { if (inStr == searchStr) { //process } }
I don't accept change; I don't deserve to live.
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
![]() |
Similar Threads
- Forms in Random access files (Visual Basic 4 / 5 / 6)
- Help!..."File Processing" *questions inside* (C++)
- Creating a Address Book using Random Access Files (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: Pointers and Arrays? can anyone explain?
- Next Thread: Why am I getting this error?
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph homeworkhelp iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting spoonfeeding string strings struct template templates text tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






