Help coderanch get a
new server
by contributing to the fundraiser
  • 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

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:
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic