• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need to ^M at end of file

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 15510
363
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
^M is just carriage return, so the Java equivalent would be '\r'.
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic