Results 1 to 4 of 4
  1. #1
    tOpach is offline Member
    Join Date
    Sep 2008
    Location
    Ankara-TURKEY
    Posts
    42
    Rep Power
    0

    Default [SOLVED] how to reading binary file and writing txt file

    I try to read a binary file and try to write index(an int array) of that binary file into a txt file. I write the txt file but it is not as I expect. For example I read 123(int array ={1,2,3}) from the binary file an write it into the txt file. It writes something like that "dop". I would like to write "123" into txt file not "dop". Could anyone tell me how can I fix that problem.

    Kind Regards.
    A stitch in time saves nine:D

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Hello,
    Could you post a snippet of your code that reads in from the binary file and tries to write it to the text file. I have a feeling that you're code is changing the numbers read in into chars which is not what you want to do, but I can't say for sure without seeing what you are doing.

    Best of luck

  3. #3
    tOpach is offline Member
    Join Date
    Sep 2008
    Location
    Ankara-TURKEY
    Posts
    42
    Rep Power
    0

    Default I found yhe problem

    I am so stupid:) I found my problem.

    What I tried:

    out.write(number[d-1]);

    Correct one:

    out.write(" "+number[d-1]+" "+"\r\n");

    I think, there should be extra argument like space or "":)

    thank you for helping.
    A stitch in time saves nine:D

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Glad you got it figured out. If you would, please go up to Thread Tools and mark this thread "solved".

Similar Threads

  1. Reading and writing to a file
    By jigglywiggly in forum New To Java
    Replies: 13
    Last Post: 03-09-2009, 11:44 AM
  2. Reading a Field in a Binary File
    By janakiram.attuluri in forum Advanced Java
    Replies: 2
    Last Post: 01-09-2008, 11:47 AM
  3. Reading Binary File and Changing data
    By janakiram.attuluri in forum Advanced Java
    Replies: 1
    Last Post: 12-21-2007, 11:10 AM
  4. reading a binary file with a RAF
    By jkurth in forum Advanced Java
    Replies: 2
    Last Post: 12-20-2007, 08:30 AM
  5. Help with File reading and writing
    By baltimore in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 07: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
  •