A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
Java in General
new lines in unix/windows
Joined: Jan 07, 2005
Mar 02, 2005 15:22:00
How can I write a carriage return and line feed to an ascii file such that it will be properly recognized on both unix and windows operating systems?
Joined: Oct 29, 2001
Mar 02, 2005 17:47:00
They're different on both systems. Different on a Mac too. Check out this
for the platform-independent way to code, and avoid using applications that don't recognize other system's EOL markers (I'm looking at you, Windows Notepad).
How To Ask Questions On JavaRanch
Joined: Aug 15, 2004
Mar 02, 2005 18:01:00
If you determine which system it is being opened by you could declare a public static final variable such as:
static final public
WINDOWS_EOL = "\r\n";
static final public String UNIX_EOL = "\n";
and then substitute these variables for the CHAR(10) or such commands at the line ends.
**How much deeper would the ocean be if Sponges didn't grow in it?**
I agree. Here's the link:
subject: new lines in unix/windows
Automating a process
using Runtime.exec() and the process exitValue = 1
How to start Tomcat?
Converting shell script to a batch file
Ports used by the application
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015