470,850 Members | 1,294 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,850 developers. It's quick & easy.

Confusion with infile.getline(...)

Trying to input a file
say file.txt
The first line I am trying to input is: Principles of Biochemistry
Trying to put "Principles of Biochemistry" into a char array book.title[]
with a max of MAXBOOKS

Why wont it work when I use...
infile.getline(book.title[], MAXBOOKS);
Sep 24 '06 #1
2 4638
I dont know what is the compilation error that gave to you, but i think u sould put book.title (without the brackets) as the first argument of getline.
Sep 24 '06 #2
make sure your initialize your struct!

Book mybooks;

and then you can use mybooks.title[i];
Sep 24 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

14 posts views Thread by Bruce A. Julseth | last post: by
7 posts views Thread by las | last post: by
reply views Thread by Donald Tyler | last post: by
reply views Thread by Steffen | last post: by
1 post views Thread by ma740988 | last post: by
18 posts views Thread by Amadeus W. M. | last post: by
15 posts views Thread by waltbrad | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.