i need help in random access files

This is a discussion on i need help in random access files within the C++ Programming forums, part of the General Programming Boards category; hello ,, please i need to answer this question : PHP Code:  struct Item     {         int ID  ;       char Name ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    8

    i need help in random access files

    hello ,, please i need to answer this question :


    PHP Code:
     struct Item 
      

          
    int ID ;
         
    char Name[20];
         
    float Prices;
         
    int Quant;
      }; 


    1- write a function that receives a raondom access file , Item ID . The
    function will add 5 to Q

    2- write a function that receives random access file , an argument , and
    ask for an item ID and information to the item to the files .

    * i am using borland C++

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,274
    You might want to read the homework policy.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    ... arjunajay's Avatar
    Join Date
    May 2005
    Posts
    203
    you can use std::fstream read(), write() functions to get and write the structure.
    use seekg(), seekp(), tellg(), tellp(), for random access.
    I belive there is an faq item on this...

    P.S. your question sounds like 'do my homework' ???
    (lser light beat me to it)

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    8
    thanks laserlight ,, arjunajay .....

    really i need ideas to solve this question ,,,not to answer it completely by you

    thanks again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lesson #3 - Math
    By oval in forum C# Programming
    Replies: 2
    Last Post: 04-27-2006, 09:16 AM
  2. question on random file access
    By ygfperson in forum C++ Programming
    Replies: 1
    Last Post: 06-16-2002, 06:21 PM
  3. How to Access a Function from Multiple Files?
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 06-08-2002, 07:24 PM
  4. random access
    By RedRum in forum C++ Programming
    Replies: 4
    Last Post: 06-04-2002, 05:34 PM
  5. Random Access Files
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 08-29-2001, 09:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21