Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to print carriage returns to file?

Patrik Svensson
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic