Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > output stream with out.flush HELP NEEDED BAD!

Reply
Thread Tools

output stream with out.flush HELP NEEDED BAD!

 
 
spidey12345
Guest
Posts: n/a
 
      02-08-2007
PrintWriter out = new PrintWriter(new
FileOutputStream("EncryptedData.txt"));

out.println("Encrypted text with monoalphabetic subsititution: ");
out.flush();
int line = 1;
for(int i = 0; i<size; i++)
{

out.print(newarray[i]);
out.flush();
if((i+1)%5==0)
{
out.print(" ");

line = line +1;
}
if(line%11 ==0)
{
out.println('\n');

line = line+1;
}

}// end for loop



// frequencies: and it's index of coincidence


out.println("Frequencies: ");


this is part of my code, simply the when i try to print out the
frequencies words, it won't let me, does it have to do with
out.flush??
any other way to do this

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      02-08-2007
On Feb 7, 7:35 pm, "spidey12345" <(E-Mail Removed)> wrote:
> PrintWriter out = new PrintWriter(new
> FileOutputStream("EncryptedData.txt"));
>
> out.println("Encrypted text with monoalphabetic subsititution: ");
> out.flush();
> int line = 1;
> for(int i = 0; i<size; i++)
> {
>
> out.print(newarray[i]);
> out.flush();
> if((i+1)%5==0)
> {
> out.print(" ");
>
> line = line +1;
> }
> if(line%11 ==0)
> {
> out.println('\n');
>
> line = line+1;
> }
>
> }// end for loop
>
> // frequencies: and it's index of coincidence
>
> out.println("Frequencies: ");
>
> this is part of my code, simply the when i try to print out the
> frequencies words, it won't let me, does it have to do with
> out.flush??
> any other way to do this


What do you mean it won't let you? Does it give an exception? Does it
not output what you expect?

Its hard for me to tell you whats going on, because your code is out
of context.

Try posting an sscce <http://www.physci.org/codes/sscce/>
This will make it easier for us to help you.

I don't see where you actually try to print out the frequencies, which
is exactly what your asking about. Thats like telling the doctor you
have a rash on your foot, and only showing him your hands.

 
Reply With Quote
 
 
 
 
spidey12345
Guest
Posts: n/a
 
      02-08-2007
On Feb 7, 10:58 pm, "Daniel Pitts" <(E-Mail Removed)>
wrote:
> On Feb 7, 7:35 pm, "spidey12345" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > PrintWriter out = new PrintWriter(new
> > FileOutputStream("EncryptedData.txt"));

>
> > out.println("Encrypted text with monoalphabetic subsititution: ");
> > out.flush();
> > int line = 1;
> > for(int i = 0; i<size; i++)
> > {

>
> > out.print(newarray[i]);
> > out.flush();
> > if((i+1)%5==0)
> > {
> > out.print(" ");

>
> > line = line +1;
> > }
> > if(line%11 ==0)
> > {
> > out.println('\n');

>
> > line = line+1;
> > }

>
> > }// end for loop

>
> > // frequencies: and it's index of coincidence

>
> > out.println("Frequencies: ");

>
> > this is part of my code, simply the when i try to print out the
> > frequencies words, it won't let me, does it have to do with
> > out.flush??
> > any other way to do this

>
> What do you mean it won't let you? Does it give an exception? Does it
> not output what you expect?
>
> Its hard for me to tell you whats going on, because your code is out
> of context.
>
> Try posting an sscce <http://www.physci.org/codes/sscce/>
> This will make it easier for us to help you.
>
> I don't see where you actually try to print out the frequencies, which
> is exactly what your asking about. Thats like telling the doctor you
> have a rash on your foot, and only showing him your hands.- Hide quoted text -
>
> - Show quoted text -


sorry, i got it to work, i was missing a out.flush() after
out.println('frequencies");

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion from Input Stream to Output Stream Kashif Ur Rehman Java 2 05-17-2007 07:50 PM
what is the different between byte stream and character stream? dolphin Java 6 03-18-2007 01:58 PM
get stream mode flags from an opened stream Alexander Korsunsky C++ 1 02-17-2007 10:38 AM
How to GET multi-word input from a *file* stream as opposed to a *console* stream? sherifffruitfly@gmail.com C++ 9 04-27-2006 04:14 PM
Doing readline in a thread from a popen4('rsync ...') stream blocks when the stream ends. Rasmusson, Lars Python 1 04-30-2004 08:10 AM



Advertisments