Results 1 to 4 of 4

Thread: outputting to a .txt file from J#

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    43

    outputting to a .txt file from J#

    I am wondering how you would output from a program to a text file for data handling.

    Any help would be much appreciated

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: outputting to a .txt file from J#

    Moved From The CodeBank

  3. #3
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: outputting to a .txt file from J#

    Again, I've never used J#, but this is how you could do it in Java.

    import
    Code:
    import java.io.*;
    Then

    Code:
    //create the output stream
    FileOutputStream out = new FileOutputStream("outFile.txt"); 
    //create the print stream to write to the output stream
    PrintStream p = new PrintStream(out); 
    //write to the printstream
    p.println ("Write a line. You can also use print if you don't want to force a new line"); 
    //and finally close
    p.close();

  4. #4
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: outputting to a .txt file from J#

    In J#, it's pretty much the same way you'd do in Java (as outlined above), but instead you use the System.IO.StreamWriter object, and you'd use the StreamWriter equivalent to println. If you have experimented with any .NET programming languages, the latter should be obvious once you start using the StreamWriter object.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width