how can I use mutiple getline functions in same app

This is a discussion on how can I use mutiple getline functions in same app within the C++ Programming forums, part of the General Programming Boards category; I'm trying to use the getline function to output to a file so I can prompt a user for a ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    how can I use mutiple getline functions in same app

    I'm trying to use the getline function to output to a file so I can prompt a user for a sentence and write that to a file, the getline function only seems to work once in the program and skips over it evertime after that?

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    13
    write "cin.ignore();" before getline(var,5) (example)
    getline read 5 letters or enter. than he add \n.
    the next geline get the \n (enter) and ignore it, so you must clean the puffer with cin.ignore();
    i hope you understand it, my english isn't very good but i hope i will be better :-)
    Last edited by sphreak; 01-03-2003 at 12:33 PM.

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    Smile

    I see what your saying, thank you very much,that worked! Your english seems to be coming along very well Thanks again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is it legal to have functions within functions?
    By Programmer_P in forum C++ Programming
    Replies: 13
    Last Post: 05-25-2009, 11:21 PM
  2. best program to start
    By gooddevil in forum Networking/Device Communication
    Replies: 4
    Last Post: 05-28-2004, 05:56 PM
  3. Passing pointers between functions
    By heygirls_uk in forum C Programming
    Replies: 5
    Last Post: 01-09-2004, 05:58 PM
  4. getline not working right
    By talz13 in forum C++ Programming
    Replies: 11
    Last Post: 12-10-2003, 10:46 PM
  5. pasword app
    By GanglyLamb in forum C Programming
    Replies: 2
    Last Post: 06-07-2003, 10:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21