Results 1 to 2 of 2
  1. #1
    Farzaneh is offline Member
    Join Date
    Aug 2008
    Rep Power

    Default writing/reading a Structure to/from a file

    Hi all,
    I need to store an object of File class into a file for further use.
    I need something like reading and writing of structures into a binary file in C/C++.
    Could you please help me and tell me how to do this?

    I need to do this because my program has a text input file and every time it starts ,it should check whether it is exactly the previous file it read from and if so reading remaining of the file, but if not it should start from the beginning of the file. I decided to use File.equal() method but I don't know how to store the File object .

    Do you think my method would meet my need? If not, what's the solution?


  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    SW Missouri
    Rep Power


    store an object of File class into a file for further use.
    What properites of the File class do you need to save?
    There is a writeObject method to serialize an object.
    Don't know if it will meet your need. Write a small test program and see.

Similar Threads

  1. Reading/Writing files through Applet
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 03-09-2009, 11:45 AM
  2. writing and reading unicode characters from a file
    By ranoosh in forum Advanced Java
    Replies: 4
    Last Post: 09-28-2008, 04:34 AM
  3. Reading/Writing a File using byte array
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-16-2008, 10:41 AM
  4. Help with File reading and writing
    By baltimore in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 06:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts