Thread: Flexibility with reading one or two strings?

  1. #16
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Ok......it still may have something to do with trailing newline characters. Try placing another getchar() at the end of your if-else chain.
    Code:
    else{
         printf("not a valid input.\n\n");
    }
    getchar();
    printf("-----------------------------");
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  2. #17
    Registered User
    Join Date
    May 2011
    Posts
    30
    AndrewHunter, it worked, thank you for your help.

    quzah, I will keep in mind about all the advice that have been given and will start cleaning up my code. I understand the reasoning and all.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with reading strings from a file
    By ldcel in forum C Programming
    Replies: 3
    Last Post: 12-01-2007, 01:31 AM
  2. Reading Strings from a file.
    By RealLife in forum C++ Programming
    Replies: 16
    Last Post: 05-12-2007, 09:17 PM
  3. Reading Strings
    By dacbo in forum C Programming
    Replies: 13
    Last Post: 11-10-2005, 02:08 PM
  4. reading and storing strings
    By Unregistered in forum C++ Programming
    Replies: 6
    Last Post: 02-01-2002, 12:38 PM
  5. Reading Strings
    By blsst40 in forum C Programming
    Replies: 1
    Last Post: 11-20-2001, 12:29 PM