• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need to ^M at end of file

 
Shardul Vyawahare
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 5349
50
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
^M is just carriage return, so the Java equivalent would be '\r'.
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 5349
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic