Author Topic: question about files  (Read 8398 times)

Govtcheez

  • Town Idiot
  • Jackass In Charge
  • Posts: 4717
  • Karma: +9/-52
question about files
« Reply #15 on: April 29, 2005, 12:03:14 PM »
OK, I'm going away now because I'm confusing everyone.

Micko

  • Veseli Bosanac
  • Jackass II
  • Posts: 44
  • Karma: +10/-0
question about files
« Reply #16 on: May 01, 2005, 10:02:43 AM »
Well here's what I found:

Quote

Q:
What is the difference between \n and \r\n ? Should I be concerned about the differences ?
What types of characters indicate a new line ?

A:

Background

There are a few characters which can indicate a new line. The usual ones are these two:

"\n" or 0x0A (10 in decimal)

This character is called "Line Feed" (LF).
"\r" or 0x0D (13 in decimal)

This one is called "Carriage return" (CR)
Different Operating Systems handle newlines in a different way. Here is a short list of the most common ones:
DOS and Windows

They expect a newline to be the combination of two characters, namely "\r\n" (or 13 followed by 10).
Unix (and hence Linux as well)

Unix uses a single "\n" to indicate a new line.
Mac

Macs use a single "\r".
This difference gives rise to a number of problems. For example, a file created under Unix (so with newlines as a single LF) will not open correctly under Window's Notepad. Any Windows program that expects newlines to be CRLF will not work correctly with these files.


[stealth]

  • the original
  • Jackass V
  • Posts: 1159
  • Karma: +56/-35
question about files
« Reply #17 on: May 01, 2005, 10:09:40 AM »
Off topic/ Hey Micko, nice to have ya aboard! /Off topic
...