Thread: Manipulating input streams.....

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    2

    Manipulating input streams.....

    Hello there!

    I would like to know if there is a way of scanning an input stream file for a certain string, as you might do with the "find" function?

    I am trying to write a code segment that will prompt for a name, read it in then search an input file for that string.

    Next, I want to prompt for a password, read it in, then read the next string in the file

    (ie - the input file might contain the name "paul" then a space then the password "butterfly"

    then finally, compare the typed string with the password from the data file

    (sorry if this sounds long winded!)

    is this possible????

    any help or inspiration gratefully recieved

  2. #2
    >> Is this possible?

    Yes. Anything is possible.

    >> search an input file for that string

    Hmmm. Like having a file like this:

    Code:
    foo bar
    cplusplus cout
    root sassafrass
    and searching to see if the user exists? I personally would input it, send it to a (possibly 2-dimensional) array. Then strcmp the tolower()s of them to see if the user matches. Then check to see if the password matches. You could even load in the file before you ever prompt the user.

    Hope this helps! Good luck!
    ~Inquirer
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    2
    cool - thanks for the speedy aid!!!

    think that i may be getting a little ahead of myself as i have not yet covered arrays - the code i am working on is a kind of melting pot as i get ideas and want to try things out - will go away and study the areas you have mentioned and re-tackle the problem

    will let you know how i get on!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Input class project (again)
    By Elysia in forum C++ Programming
    Replies: 41
    Last Post: 02-13-2009, 10:52 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. Manipulating Input
    By Sridar in forum C++ Programming
    Replies: 3
    Last Post: 02-13-2005, 11:24 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 01:50 PM