×

Discussion Board

Results 1 to 2 of 2

Threaded View

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    7

    Cannot write int (integer) values to file using write(int i) method

    Hello all, I couldn't find my issue either on the internet or here so here I am writing.

    I am transferring an integer array into a file. I can't write integer values using outputstream.write (int i) method. Converting the integer variable into bytes fails as well. However, converting anything to string and then to bytes (using string.getBytes() ) and then outputstream.write(byte [] buffer) works. I may attach my code if needed.
    At first I thought it's somehow related to the fact I passed arguments like
    [I]for (int i = 0; i < 1000; i++){
    for (int j = 0; j < 4; j++){
    write (array[j]);
    } }

    but tried with a temporal variable and it still didn't work. I made clean build as well, to no effect.

    I am opening the stream as follows
    fconn = (FileConnection)Connector.open(url, Connector.READ_WRITE);
    if (!fconn.exists())
    {
    fconn.create();
    }
    OutputStream ops = fconn.openOutputStream(fconn.fileSize());


    I am using Netbeans 7.0 and Symbian Belle SDK and run the program on an E52.

    I'd be very grateful for your help
    Last edited by antonen; 2012-02-28 at 21:23.

Similar Threads

  1. Replies: 2
    Last Post: 2011-06-30, 11:35
  2. very simple middlet class to write to write a text file
    By a_sina_a in forum Mobile Java General
    Replies: 10
    Last Post: 2008-03-07, 16:35
  3. How can I write binary values using RFile?
    By mabdulmoniem in forum Symbian
    Replies: 5
    Last Post: 2007-10-09, 14:12
  4. read integer values out of a text file
    By michael.schrenk in forum Symbian
    Replies: 4
    Last Post: 2005-02-19, 19:55
  5. How to read integer and float values from a file?
    By Falcons in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-06-04, 04:57

Posting Permissions

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