Solved

Getting a set of numbers from a file to cin >>

Posted on 2004-08-30
3
193 Views
Last Modified: 2010-04-01
Hi. I've just started C++ recently and i want to know how to get the data from a file into the program to store it as a char.
I can open the file and make it show the contents in dos when running my console, however, i want to be able to use this in a cin >>. I have tried to place "cin >>" after the data is inputted, but this doesn't work.

Any help
?
Thanks
0
Comment
Question by:warnesey
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
mrwad99 earned 50 total points
ID: 11933555
If you spend 10 minutes reading http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200401/notes/io.html you will be able to answer your own question as well as many more about file I/O that you may have...

0
 

Author Comment

by:warnesey
ID: 11936323
Hey. Thanks a bunch. Really helped and now i gottit working :)
Cheers
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 11939647
Glad the link helped.

If there is nothing else that can be helped with then you need  to close this question to prevent annoying the moderators who have to clean up ungraded questions and possible negative feedback.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

867 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

16 Experts available now in Live!

Get 1:1 Help Now