Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Write into a file (https://www.askmehelpdesk.com/showthread.php?t=384320)

  • Aug 7, 2009, 05:04 AM
    Mythj0j0
    write into a file
    Hi there,
    I'm tryign to write in a file using this command ,but all I get is the wrong answer although in the command line I get the correct answer in integer e.g 5 or 6 etc..

    -not the whole code-
    FileOutputStream fos = new FileOutputStream(args[0]);
    byte outbuffer=new byte[sizeob];
    int counter;
    for(int j=0;j<size;j++){
    outbuffer[j]=(byte)counter;
    System.out.println(" "+ outbuffer[j]);
    fos.write(outbuffer[j]);

    }

    I tried to convert it to character ,but it idn't work either or int ?
    does any one knows how to get the right answer?
    this is the simple version of my code, the other version is a 2d array that has the value of the counter,
    thanks

  • All times are GMT -7. The time now is 07:25 AM.