In Java, of course. I\'m writing a program and running it under a Windows environment, but I need the output (.csv) to be done in Unix format. Any easy solution? Thanks!
A paranoid programmer would synchronize on the system properties object, at least if different Printwriters needs different types of line terminators.
public static PrintWriter createPrintWriter(OutputStreamWriter out, boolean autoflush){
Properties props = System.getProperties();
synchronized (props) {
Object old = null;
try {
old = props.setProperty("line.separator", "\n");
return new PrintWriter(out, autoflush);
} finally {
if( old != null ) {
props.put("line.separator", old);
}
}
}
}