comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent <daemon2@internet.lu>
Subject: Re: Annoying behavior
Date: Sat, 25 Apr 2015 13:13:22 -0700 (PDT)
Date: 2015-04-25T13:13:22-07:00	[thread overview]
Message-ID: <0ddcdd13-c29c-46e2-b516-3cc26a964d6e@googlegroups.com> (raw)
In-Reply-To: <mhgpv6$kk5$1@dont-email.me>

On Saturday, April 25, 2015 at 9:30:43 PM UTC+2, Georg Bauhaus wrote:
> On 25.04.15 20:58, Laurent wrote:
> 
> > The Show Invisibles isn't bad but I thought more in the direction of <eol> and not this sign which I have no idea how it is called. Probably not necessary at all but better have something you don't need than the opposite.
> 
> In case you are a little familiar with a command line interface
> to an OS, then on a Mac, open Terminal, and cd to the directory
> where your files are stored. Type the "file" command and put a name
> of at least one file in question after the program's name. Then,
> type ENTER (I have here two files, both having one line with the
> word "Hello" on it):
> 
> $ file dos.txt unix.txt
> dos.txt:  ASCII text, with CRLF line terminators
> unix.txt: ASCII text
> $
> 
> A closer look at what is in a file is possible using the od program
> (octal dump) and its -c (character) switch:
> 
> $ od -c dos.txt
> 0000000    H   e   l   l   o  \r  \n
> 0000007
> $
> 
> > Which makes me wonder if it matters which line endings I use. Classic Mac is CR, Unix LF and Windows CRLF.
> >
> > Just tried it. Makes indeed a difference. Which means that if I ever wanted to port my little program to an other OS, I have to think to modify the text file.
> 
> One way to distribute text files is in a ZIP: unzip programs typically
> feature a switch that allows automatic translation of line endings
> when unpacking. The unpacked text files then follow the OS's conventions.
> 
> 
> > Something which would make me search for hours to find the error in my code which is correct but it is the stupid text file which causes the problem.
> >
> > How does the Text_IO "know" which line ending to use?
> 
> GNAT's Text_IO works better with lines that follow the OS's conventions
> for EOL.

I rarely use the terminal. Changing the path in my .profile and hunting invisible
files. Running my little programs which read in txt files because otherwise the file won't be found.

The automatic translation by the unzip is good to know.

Have read the man pages for both commands. Didn't know that storing text in files is so complicated. 

Thanks for this info.

Laurent


  reply	other threads:[~2015-04-25 20:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 21:40 Annoying behavior Laurent
2015-04-25  4:31 ` gautier_niouzes
2015-04-25  6:51   ` Laurent
2015-04-25  4:50 ` Niklas Holsti
2015-04-25  7:15   ` Laurent
2015-04-25  8:10     ` Niklas Holsti
2015-04-25 15:37       ` Laurent
2015-04-25 13:54 ` Stephen Leake
2015-04-25 15:46   ` Laurent
2015-04-25 17:02     ` Simon Wright
2015-04-25 17:41     ` Niklas Holsti
2015-04-25 18:58       ` Laurent
2015-04-25 19:30         ` Georg Bauhaus
2015-04-25 20:13           ` Laurent [this message]
2015-04-25 21:46             ` Laurent
2015-04-25 23:16           ` Bob Duff
2015-04-26 10:38     ` Jedi Tek'Unum
2015-04-26 11:52       ` Textedit and txt Laurent
2015-04-26 13:21         ` brbarkstrom
2015-05-06 21:23           ` Randy Brukardt
2015-05-07 21:12             ` Laurent
2015-05-07 21:48               ` Simon Wright
2015-05-07 22:24                 ` Laurent
2015-05-08  5:50                   ` Simon Wright
2015-05-08  7:35                     ` Laurent
2015-05-08 23:35               ` Randy Brukardt
2015-05-09 19:25                 ` Laurent
2015-05-09 21:36                   ` Anh Vo
2015-05-11 17:00                 ` Shark8
2015-05-11 17:49                   ` Dmitry A. Kazakov
2015-05-09 15:23               ` brbarkstrom
2015-05-12  1:10                 ` Randy Brukardt
2015-05-12 12:44                   ` brbarkstrom
2015-05-12 21:57                     ` Randy Brukardt
2015-05-13 12:07                       ` brbarkstrom
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox