1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

need help in urgent...(file stream)

Discussion in 'C++' started by kslpeter87, Mar 5, 2008.

  1. kslpeter87

    kslpeter87 New Member

    Joined:
    Jul 20, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    The problem as follow:
    Create Inventory structure contain members:
    1.item description
    2.quantity
    3.date added item

    Then store the structure into a .txt file. (i name it as "Inventory.txt")
    Display a menu to let user choose an option:
    1. Insert new record
    2. Display any record in the txt file
    3. Edit/update any record in the txt file



    How to access to a particular record in the txt file i created ???
    i've tried my best to look for solution in the reference books yet couldn't get an answer.
    Anyone here could suggest an algorithm to perform that task ?

    :( :( :(

    My Inventory.txt: (i use "_" to replace " ")

    Description___________________quantity________date added
    Colour pencil_________________6_______________03/03/2008
    Eraser________________________20______________02/03/2008
     
  2. imported_xpi0t0s

    imported_xpi0t0s New Member

    Joined:
    Jul 18, 2008
    Messages:
    101
    Likes Received:
    0
    Trophy Points:
    0
    There's not much you need by way of an algorithm, pretty much just open the file, loop through it until you find the record you want then do whatever you want with that record.

    How far have you got with the program and where are you stuck?
     

Share This Page