cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Getting chars from cin.
Getting chars from cin.
Oct 22, 2014 at 11:40pm UTC
Sh0es
(92)
I'm trying to extract characters from a file in a project I'm working on. The only problem is that there doesn't seem to be any method in ifstream (or istream for that matter) that returns chars. What am I overlooking?
Oct 23, 2014 at 1:02am UTC
crimsonzero2
(213)
You can use the cin.get() function, with the exception of doing it like this:
1
2
3
ifstream infile; /...
char
a = infile.get()
http://www.cplusplus.com/reference/istream/istream/get/
This above is an example about it also.
Topic archived. No new replies allowed.