Author Topic: question about files  (Read 8421 times)

Micko

  • Veseli Bosanac
  • Jackass II
  • Posts: 44
  • Karma: +10/-0
question about files
« on: April 28, 2005, 06:03:40 PM »
When you open file stdio.h (in attachment) you'll se (at least I see) that is very hard to read wth some weird symbols etc. I made following steps:
Select All -> Copy and Past to MS Word(here's becoming OK) ->Select all -> Copy and Paste to new file stdio1.h.
Now stdio1.h is like any other normal text file. Now I assume this is because of different file system (maybe I'm not using appropriate expressino) in Linux and Windows. Is this correct?
Why the look is different? I read something about Linux file formatting, but I was hoping someone here will explain it to me.
Thanks

- Micko
« Last Edit: April 28, 2005, 06:08:59 PM by Micko »

Mike

  • Jackass In Charge
  • Posts: 11248
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
question about files
« Reply #1 on: April 28, 2005, 06:15:19 PM »
Linux uses one character for new lines "\n" (line feed).  MS uses two characters for new lines "\r\n" (carriage return and line feed)

So MS has a problem with it because it expects both characters but only gets one

Micko

  • Veseli Bosanac
  • Jackass II
  • Posts: 44
  • Karma: +10/-0
question about files
« Reply #2 on: April 28, 2005, 06:35:01 PM »
That is why stdio1.h is a little bigger.
So basically when windows file manager (or what?) find only \n it replace it with some strage marklike a little rectangle. OK
I use win xp and when I use something like this in C:
Code: [Select]

fprintf(fp, "Test\n");


Windows will write Test\r\n in file. Am I right ?

sand_man

  • Super Jackass
  • Jackass II
  • Posts: 54
  • Karma: +10/-0
question about files
« Reply #3 on: April 29, 2005, 01:18:59 AM »
wouldn't it be
\n = \f\r

Micko

  • Veseli Bosanac
  • Jackass II
  • Posts: 44
  • Karma: +10/-0
question about files
« Reply #4 on: April 29, 2005, 08:01:26 AM »
Now, I lost you. What is \f ?

Ken Fitlike

  • Jackass V
  • Posts: 1568
  • Karma: +25/-22
  • Ebeneezer McScrooge
question about files
« Reply #5 on: April 29, 2005, 08:12:01 AM »
No idea.

Stick to what Mike's said as that's the way it is.

Download SciTE - it can display and convert between linux and window line break formats, as well as being a very good text/code editor that works on both operating systems so you can use it to view any text file (including that stdio.h) as a 'normal' text file regardless of its line break characteristics.
And what rough beast, its hour come round at last,
Slouches towards Bethlehem to be born?.

Major_Small

  • Jackass IV
  • Posts: 317
  • Karma: +10/-0
    • http://www.johnshaoonline.com
question about files
« Reply #6 on: April 29, 2005, 09:57:42 AM »
Quote from: Ken Fitlike
No idea.

Stick to what Mike's said as that's the way it is.

Download SciTE - it can display and convert between linux and window line break formats, as well as being a very good text/code editor that works on both operating systems so you can use it to view any text file (including that stdio.h) as a 'normal' text file regardless of its line break characteristics.

/f is a form-feed character... used in old-school printing. to push the rest of the page out of the printer after you were done printing on it.
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
51 Members so far, are YOU a member?
Current team score: 827850 (ranked 357 of 41389)

The CBoard team is doing better than [COLOR='#0000FF']99.13%[/COLOR] of the other teams
Top 5 Members: Xterria(331048), Bennet(64957), pianorain(56621), Codeplug(35842), JaWiB(34917)

Last Updated on: Mon, 28 Nov, 2005 @ 3:21 PM EST

Govtcheez

  • Town Idiot
  • Jackass In Charge
  • Posts: 4717
  • Karma: +9/-52
question about files
« Reply #7 on: April 29, 2005, 10:10:10 AM »
Shouldn't it be a line feed and a carriage return, though?

Major_Small

  • Jackass IV
  • Posts: 317
  • Karma: +10/-0
    • http://www.johnshaoonline.com
question about files
« Reply #8 on: April 29, 2005, 10:29:54 AM »
Quote from: Govtcheez
Shouldn't it be a line feed and a carriage return, though?

did it really matter back in the day? MS just chose an order and went with it :D
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
51 Members so far, are YOU a member?
Current team score: 827850 (ranked 357 of 41389)

The CBoard team is doing better than [COLOR='#0000FF']99.13%[/COLOR] of the other teams
Top 5 Members: Xterria(331048), Bennet(64957), pianorain(56621), Codeplug(35842), JaWiB(34917)

Last Updated on: Mon, 28 Nov, 2005 @ 3:21 PM EST

Micko

  • Veseli Bosanac
  • Jackass II
  • Posts: 44
  • Karma: +10/-0
question about files
« Reply #9 on: April 29, 2005, 10:37:00 AM »
Thanks guys

Mike

  • Jackass In Charge
  • Posts: 11248
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
question about files
« Reply #10 on: April 29, 2005, 10:54:44 AM »
It's been a while since I've actually looked so I can't remember if its 13 10 or 10 13.  I know its \r\n when doing windows stuff.
I do think my typewriters did it newline carriage return though.

Govtcheez

  • Town Idiot
  • Jackass In Charge
  • Posts: 4717
  • Karma: +9/-52
question about files
« Reply #11 on: April 29, 2005, 11:20:03 AM »
Quote from: Major_Small
did it really matter back in the day? MS just chose an order and went with it :D

I didn't mean the order was important (it's not).  I meant that it was important that it was a line feed instead of a form feed, unless you want one line per page.

Major_Small

  • Jackass IV
  • Posts: 317
  • Karma: +10/-0
    • http://www.johnshaoonline.com
question about files
« Reply #12 on: April 29, 2005, 11:28:20 AM »
Quote from: Govtcheez
I didn't mean the order was important (it's not).  I meant that it was important that it was a line feed instead of a form feed, unless you want one line per page.

well, yeah... I think \n kinda-sorta takes the place of a linefeed... maybe?  :dunno:
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
51 Members so far, are YOU a member?
Current team score: 827850 (ranked 357 of 41389)

The CBoard team is doing better than [COLOR='#0000FF']99.13%[/COLOR] of the other teams
Top 5 Members: Xterria(331048), Bennet(64957), pianorain(56621), Codeplug(35842), JaWiB(34917)

Last Updated on: Mon, 28 Nov, 2005 @ 3:21 PM EST

Govtcheez

  • Town Idiot
  • Jackass In Charge
  • Posts: 4717
  • Karma: +9/-52
question about files
« Reply #13 on: April 29, 2005, 11:50:58 AM »
We're going in circles :(

All I'm saying is that sandman's response of \f\r is going to be wrong; it should be \l\r or \r\l.

Major_Small

  • Jackass IV
  • Posts: 317
  • Karma: +10/-0
    • http://www.johnshaoonline.com
question about files
« Reply #14 on: April 29, 2005, 12:02:40 PM »
Quote from: Govtcheez
We're going in circles :(

All I'm saying is that sandman's response of \f\r is going to be wrong; it should be \l\r or \r\l.

oh, well I kinda figured that was a given :(
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
51 Members so far, are YOU a member?
Current team score: 827850 (ranked 357 of 41389)

The CBoard team is doing better than [COLOR='#0000FF']99.13%[/COLOR] of the other teams
Top 5 Members: Xterria(331048), Bennet(64957), pianorain(56621), Codeplug(35842), JaWiB(34917)

Last Updated on: Mon, 28 Nov, 2005 @ 3:21 PM EST