aspose file tools*
The moose likes I/O and Streams and the fly likes need to ^M at end of file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "need to ^M at end of file" Watch "need to ^M at end of file" New topic
Author

need to ^M at end of file

Shardul Vyawahare
Greenhorn

Joined: Dec 30, 2010
Posts: 8
Hi All,

I am not familiar with Unix. I am creating a text file through the my Java code. Now my client want me to add ^M character at end of file so he will identify end of file in Unix env. How to add ^M in file is it any escape seq char . does he mean to add "\r\n" at the end ?

Please help.

SH
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3379
    
    9
^M is just carriage return, so the Java equivalent would be '\r'.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

The normal UNIX/Linux/Max OSX line separator in just "\n". It's Windows that uses "\r\n", so your client might not have that right. Also, it's a line separator, not a file ender. There's no file ending character in UNIX. DOS used to use ^Z, but I haven't seen that in a long time.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3379
    
    9
I was thinking that maybe the fact that carriage return is not used in UNIX would allow it to be a custom file ending character for the client's file format?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need to ^M at end of file
 
Similar Threads
File upload and ^M chars
where can I post qn related to line ending utility
Remove ^M character in text file
How To Edit a File in the Unix?
Specifiying Java Version