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
Reading from a .txt file.
Reading from a .txt file.
Sep 18, 2011 at 11:29am UTC
Ben Duncan
(163)
A program I'm making takes a username and password.
The username is the name of the .txt file and the password is kept in the file.
I was wondering how I could get an input from the user and check whether or not it was the same in the file.
Sep 18, 2011 at 12:13pm UTC
hanst99
(2869)
http://cplusplus.com/reference/iostream/fstream/
Reply back if you have troubles. But only after you've read what's at the link.
Sep 18, 2011 at 12:49pm UTC
Ben Duncan
(163)
I read the link, but nothing (that I can see) reads data from the file.
Sep 18, 2011 at 12:54pm UTC
hanst99
(2869)
The f before stream stands for file. You can use fstreams to read data from or write to files. So... what's your problem?
Sep 18, 2011 at 8:47pm UTC
Ben Duncan
(163)
Say the password, 'hello', is in the file, how could I get the program to read 'hello' from the file and hold it to a variable?
I can't find anything on the fstream that does the job.
Sorry if I'm being a pain, I just know that something
must
do it.
Last edited on
Sep 18, 2011 at 9:02pm UTC
Topic archived. No new replies allowed.