Thread: i need help in random access files

  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
    28,413
    You might want to read the homework policy.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    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, 08:16 AM
  2. question on random file access
    By ygfperson in forum C++ Programming
    Replies: 1
    Last Post: 06-16-2002, 05:21 PM
  3. How to Access a Function from Multiple Files?
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 06-08-2002, 06:24 PM
  4. random access
    By RedRum in forum C++ Programming
    Replies: 4
    Last Post: 06-04-2002, 04:34 PM
  5. Random Access Files
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 08-29-2001, 08:06 AM