View Single Post
Join Date: Jul 2008
Posts: 135
Reputation: amrith92 is on a distinguished road 
Solved Threads: 13
amrith92's Avatar
amrith92 amrith92 is offline Offline
Junior Poster

Line count not working....

 
0
  #1
Sep 3rd, 2008
hey,

This might be naive, but how come this bit of code isn't working???

  1. int lc=0;
  2.  
  3. read.open(filename_user.c_str(), ios::in);
  4. while(getline(read, linecount, '\n'))
  5. {
  6. ++lc;
  7. }

Have looked through the internet, and this code seems to be fine, so what is it that makes it not work??

the output is always 0, no matter what file I try to open.
"C++ : Where friends have access to your private members."
C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."
Reply With Quote