Sticky: Need Simple C++ Help Right Away!!!

Discussion in 'Software' started by NeoNemesis, Jul 5, 2004.

  1. NeoNemesis

    NeoNemesis Moutharrhea

    I am need of C++ help for a very very simple question. I am trying to make a program and part of the program has to store variable data and input data that the user inputs (address book and username are some of the things that I have in this program) for the next time the program is opened. I'm using the ifstream and ofstream commands right now to store the data into a text file called username.txt for storing the users selected username (my goal is to make the program recognize the user by the data put into the username.txt by reading the file. So like every time the program loads it will say 'Welcome Desmond' if I decide to put my name in as the username. Well I have the storing part down and now I need to work on outputing the stuff from the text file back into the program. I'm using the standard ofstream to open the file and what not but when it outputs the person's username that they entered from the first registration part of the program it outputs it as 0xFFFFFFF. I have tried for days to get this to output the username in regular english and the damn thing won't work. I also want it to store the contents of the file when it opens it to a variable for the rest of the program to use it. So like later on in the program it can say like "Good Bye! Desmond' or something. Please help me since I really can't continue my program without this to work. This is probably so simple but I just learned C++ a couple days ago from picking up on a book I purchased a while back. So just keep that mind and I'm only 14 years old.

    It would be appreciated if people email their responds to me at neonemesis4@Hotmail.com instead of posting here so that way I can be sure to read them. But you don't have to. :)
     
  2. NeoNemesis

    NeoNemesis Moutharrhea

    Can someone please help me...
     
  3. micr0dv8

    micr0dv8 Private First Class

    Hmm sounds like you are pointing to a place in memory instead of a file.....are you using pointers etc.?
     
  4. snakefoot

    snakefoot Sergeant Major

  5. snakefoot

    snakefoot Sergeant Major

    Hehe didnt notice the "Sticky"-thing was part of the topic, nicely done :)
     
  6. NeoNemesis

    NeoNemesis Moutharrhea

    No I'm not using pointers.

    I will try fstream. I also have another question though. Can someone give me a simple example menu of where the user just has to press like one key and it goes to another function. Thanx. I want to redesign my menu right now because right now you have to press the key and then press enter and I'm wondering if I can just make it go to the function as soon as the person presses a key.
     
  7. snakefoot

    snakefoot Sergeant Major

    I guess in a C++ world the function would be:

    cin.get()

    There also exist some non-standard functions (Though they are not supported on all compilers)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds