Solved

what kind of function is thiS?

Posted on 1997-04-06
2
183 Views
Last Modified: 2010-04-10
hi there,
        I am doing a project on creating a simple database (storing particulars of friends) using C++. The user is suppose to key in the required data and the program is to search for the data in the external file and display it on the screen for the user and therefore the user can edit or just view the data he/she wants. Searching for the data in the external file is something which i cannot do since the examples given by our prof is not sufficient and so are the books I borrow from the library school.

And so what kind of function in C++ can it search for the required data (the file is suppose fill with alot of data ) and display it on the screen.
It will be a great help if it is in source code
0
Comment
Question by:ftyk
2 Comments
 
LVL 5

Accepted Solution

by:
yonat earned 50 total points
ID: 1162603
You can read using an fistream. For example:

#include <fstream.h>

char line[MAX_LINE_LEN];
fstream f("bla.txt");
f >> line;
// do stuff with it.
f.close();

The way to display text on screnn depends on the operating
system.
If you just want text I/O, you can use cout:

#include <iostream.h>

cout << "some text";

0
 

Author Comment

by:ftyk
ID: 1162604
Edited text of question
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now