View Single Post
Old 02-21-2006, 11:49 PM   PM User | #5
YodaCows
New to the CF scene

 
Join Date: Jan 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
YodaCows is an unknown quantity at this point
I tried removing the while loop, but now it doesn't print anything to the file
Code:
public class scrapeSite
{
    public static FileOutputStream Output;
    public static PrintStream file;
    public static String line;

   public static void main( String[] args )
   {
      try
      {
         BufferedReader br;
         BufferedWriter bw;
         Socket s = new Socket( "www.yahoo.com", 80 );
         br = new BufferedReader( new InputStreamReader( s.getInputStream() ));
         bw = new BufferedWriter( new OutputStreamWriter( s.getOutputStream() ));

         bw.write( "GET / HTTP/1.0\n\n" );
         bw.flush();

         Output = new FileOutputStream("myfile.txt");
         file = new PrintStream(Output);
         file.println (line);
        }
      catch( IOException e )  // catch any errors
      {
         System.out.println( "There was an IOException error!" );
      }
   }
}
I've tried every combination...moving the file/Output lines all over.
What am I not doing right (besides everything)?

~YC
YodaCows is offline   Reply With Quote