Solved

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

Posted on 2004-08-30
3
179 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
Comment Utility
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
Comment Utility
Hey. Thanks a bunch. Really helped and now i gottit working :)
Cheers
0
 
LVL 19

Expert Comment

by:mrwad99
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

772 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

10 Experts available now in Live!

Get 1:1 Help Now