Thread: something extremely wierd

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    4

    something extremely wierd

    i have some code, and its for an ai program

    in the program, the user types in a phrase. the prog loads a file with the list of phrases into a map, and displays the proper output.

    for example, if the user types in hello, the program will respond by saying welcome

    if the user types in something unknown, the program will ask for the proper response for the next time. it then loads it into the map and file

    this is where my problem is

    for some reason, it does not write it to the file or insert it in the map

    im attaching the entire file so u can see if there is anything wrong with all the parts, or if there is some place i can improve something

    i believe it is very basic, but i am not sure

    please reply ASAP, because this is for school. if u cannot do it, please ask someone else to help, because this is very important

    thank you for the help

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    write to a different file than you read from.

    http://faq.cprogramming.com/cgi-bin/...&id=1043284351

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    4
    but i have to use the same file, because it wont read the most updated list, it will read the commands already there, and the new commands will go to a different file, so it wont read them

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    4
    actually u were rite

    i used the same file name, but i made it two different objects

    one an ifstream, and the other an ofstream, but both read/wrote to the same file

    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Wierd **** - Order of Drawing Stuff?
    By Tonto in forum Game Programming
    Replies: 9
    Last Post: 11-09-2006, 09:56 PM
  2. Wierd chars...
    By mikahell in forum C++ Programming
    Replies: 8
    Last Post: 08-06-2006, 07:18 PM
  3. Wierd txt document
    By Necrofear in forum Tech Board
    Replies: 4
    Last Post: 05-22-2006, 09:24 PM
  4. Wierd Text from File
    By hoangvo in forum C++ Programming
    Replies: 1
    Last Post: 07-30-2005, 12:05 AM
  5. wierd errors
    By DeepFyre in forum C++ Programming
    Replies: 7
    Last Post: 12-21-2004, 09:32 PM