File file = new File("F:\\New Projcts\\Ex\\hello.csv");
file.createNewFile();
It generate only .CSV(Comma delimited)
but not in .CSV(MS-DOS)
how to create .CSV(MS-DoS)
file in java
I assume that your issue is about the charset and not about the choice of CSV pattern. In Java, output stream uses the default charset, ie dixit Charset.defaultCharset() javadoc: the default charset is determined during virtual-machine startup and typically depends upon the locale and charset of the underlying operating system.
Unless you are working with a very old MSDOS os, it'd never be the case. The charset has to be specified with something like:
OutputStreamWriter os = new OutputStreamWriter(
new FileOutputStream("FileFromNonJavaProgram.txt"), "Cp850" /* MS-DOS Latin-1 */);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.