Thread: file i/o

  1. #1
    Registered User
    Join Date
    Nov 2001

    Exclamation file i/o

    Hi im makeing a program and what i want to do is have usernames just to keep prefrences straight so i want it to open user.txt and match the user input and find the one in there then make a variable like 34 to denote thats its there preferences how would i do this if im not giveing enough information tell me and ill put more in
    • 0927
    • a.k.a 0 9 two 7

  2. #2
    Registered User
    Join Date
    Sep 2001
    i'm not exactly clear on what you mean, but to open a data file include fstream.h and try this:

    whatevertype data;
    ifstream infile(users.txt);


    /*this will take the first word or number in the file and save in into data. if you want to get the whole file, your will have to declare an array and make a loop. */

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. 2 questions surrounding an I/O file
    By Guti14 in forum C Programming
    Replies: 2
    Last Post: 08-30-2004, 11:21 PM
  4. File I/O problems!!! Help!!!
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 05-17-2002, 08:09 PM
  5. advice on file i/o
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-29-2001, 05:56 AM