Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@himanshu-sharma-HOM7Hg • Mar 26, 2010
hey i'm not a gud experienced person but i can sort out some of your prob as i can...so tell....? -
@sanamalik-zl2k9Y • Mar 28, 2010
hey thanx for contacting me. actually i am doing a project for which i need your help to do some tasks. now i want to write the output of the program in a seperate file for which i added the following code
FileOutputStream out; // declare a file output object
PrintStream p; // declare a print stream object
try
{
// Create a new file output stream
// connected to "myfile.txt"
out = new FileOutputStream("myfile.txt");
// Connect print stream to the output stream
p = new PrintStream( out );
p.println ("This is written to a file");
p.close();
}
catch (Exception e)
{
System.err.println ("Error writing to file");
}
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Unwanted errors happen");
}
}
but it just prints " this is written to a file".
i want to write the whole result that apperas in console.
please suggest me the way to do so.
one thing more, if u don't mind, can i have ur e-mail ID so that i can contact u there?
regards.
-
@sanamalik-zl2k9Y • Mar 28, 2010
hey thanx for contacting me. actually i am doing a project for which i need your help to do some tasks. now i want to write the output of the program in a seperate file for which i added the following code
FileOutputStream out; // declare a file output object
PrintStream p; // declare a print stream object
try
{
// Create a new file output stream
// connected to "myfile.txt"
out = new FileOutputStream("myfile.txt");
// Connect print stream to the output stream
p = new PrintStream( out );
p.println ("This is written to a file");
p.close();
}
catch (Exception e)
{
System.err.println ("Error writing to file");
}
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Unwanted errors happen");
}
}
but it just prints " this is written to a file".
i want to write the whole result that apperas in console.
please suggest me the way to do so.
one thing more, if u don't mind, can i have ur e-mail ID so that i can contact u there?
regards.