From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Re-write a file in Ada
Date: Mon, 18 Jan 2016 18:49:06 +0100
Date: 2016-01-18T18:49:06+01:00 [thread overview]
Message-ID: <n7j8de$aj0$1@dont-email.me> (raw)
In-Reply-To: <f39a3b30-d34f-4d2a-8ffa-94af9541d9d5@googlegroups.com>
Le 18/01/2016 18:25, comicfanzine@gmail.com a écrit :
> In conclusion , i better use another way .
>
> Feel free to propose anything else , if you have a idea .
>
You must realize that in most operating systems, a file has no notion of
"line". A file is a heap of bytes, some of which are conventionnally
used to represent line ends. As a consequence, there is no way of
knowing the number of lines in a file without reading the whole file.
This is an OS issue, not a programming language issue.
If you don't mind reading the file twice, you can first count lines by
calling Skip_Line (and counting) until you hit the end of file. Then you
can declare your array, call Reset to rewind the file, and process the
file as you want.
HTH
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
next prev parent reply other threads:[~2016-01-18 17:49 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 15:55 Re-write a file in Ada comicfanzine
2016-01-07 13:02 ` comicfanzine
2016-01-08 20:35 ` comicfanzine
2016-01-09 9:50 ` Brian Drummond
2016-01-08 21:22 ` Randy Brukardt
2016-01-08 22:08 ` Anh Vo
2016-01-10 16:54 ` comicfanzine
2016-01-10 18:59 ` Björn Lundin
2016-01-11 17:16 ` Brian Drummond
2016-01-18 15:05 ` gautier_niouzes
2016-01-19 12:24 ` Brian Drummond
2016-01-19 16:52 ` gautier_niouzes
2016-01-21 12:26 ` Brian Drummond
2016-01-10 22:57 ` comicfanzine
2016-01-11 1:59 ` Anh Vo
2016-01-11 10:09 ` Björn Lundin
2016-01-18 0:22 ` comicfanzine
2016-01-18 9:50 ` AdaMagica
2016-01-18 17:27 ` Björn Lundin
2016-01-18 11:52 ` Brian Drummond
2016-01-18 17:30 ` Björn Lundin
2016-01-18 17:25 ` comicfanzine
2016-01-18 17:49 ` J-P. Rosen [this message]
2016-01-18 18:37 ` Simon Wright
2016-01-19 12:33 ` Brian Drummond
2016-01-19 14:40 ` Simon Wright
2016-01-21 12:31 ` Brian Drummond
2016-01-19 12:04 ` comicfanzine
2016-01-19 14:29 ` Anh Vo
2016-01-19 14:35 ` Simon Wright
2016-01-19 16:54 ` Jeffrey R. Carter
2016-01-19 17:32 ` Anh Vo
2016-01-19 16:53 ` Stephen Davies
2016-01-20 1:12 ` comicfanzine
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox