output stream with out.flush HELP NEEDED BAD!

  • Follow


    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

0
Reply swq_shan10 (14) 2/8/2007 3:35:40 AM

On Feb 7, 7:35 pm, "spidey12345" <swq_sha...@hotmail.com> 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.

0
Reply googlegroupie (586) 2/8/2007 3:58:06 AM


On Feb 7, 10:58 pm, "Daniel Pitts" <googlegrou...@coloraura.com>
wrote:
> On Feb 7, 7:35 pm, "spidey12345" <swq_sha...@hotmail.com> 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");

0
Reply swq_shan10 (14) 2/8/2007 5:08:28 AM

2 Replies
16 Views

(page loaded in 6.44 seconds)


Reply: