• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to print carriage returns to file?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I'm doing a simple crypto program that in short opens a file, read the contents into a int[],
apply the crypto algortim, type casts the int[] to a char[] and writes it back to file.
The problem:
I want to keep the "format" of the text. The reader reads "carriage returns" as 13 10 wich I have a hard time getting the printer to print in a good way. So the question is how to insert a '\r' or '\n' in a char array that can be printed to file? Am I using the wrong printer for the job? (code at the end)
On a related note I seem to get some "strange" results with numbers/chars >150 in the ASCII chart, unsure if it's the printer, writer or caster thats the issue. No biggie for my program though, just curious to why this happens.

For reading the file I use:

And for printing the result:
 
reply
    Bookmark Topic Watch Topic
  • New Topic