Ask Experts Questions for FREE Help !
Ask
    Mythj0j0's Avatar
    Mythj0j0 Posts: 1, Reputation: 1
    New Member
     
    #1

    Aug 7, 2009, 05:04 AM
    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

Check out some similar questions!

My girlfriend wants me to write her a soppy message, what do I write or say ? [ 18 Answers ]

Well yeah, my girlfriend wants me to write a soppy, love felt message and I don't know what to write. Can anyone help me or give me some clues ? Would be a big help thanks

I have 20 days to file my response. What and how should I write [ 1 Answers ]

I had a mortgage company in Florida with three other partners. We borrowed money from hard money lending company and they bought computers for us and we entered a lease agreements and two of us signed personally for 24 months. We only paid 14 months and tried to negotiate they didn't want to... ...

Write an interactive C++ program that reads a series of 12 temperatures from a file c [ 1 Answers ]

Write an interactive C++ program that reads a series of 12 temperatures from a file called "12temp.dat". It should display to the user each temperature and the difference between the current temperature and the one preceding it via cout. The difference is not output for the first temperature that...

Destination file is write protected [ 0 Answers ]

Hello, I'm trying to install a program and I'm getting this error message Warning - Can not copy file D:\temp\SETUP1.EX_ since the destination file is write protected I click Ok then another message appear Invalid command-line parameters. Unable to continue Then Setup wasn't complete...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.