Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1142
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!feed.xsnews.nl!border-2.ams.xsnews.nl!feeder.xennanews.com!nf40.xennanews.com!not-for-mail |
|---|---|
| From | Cecil Westerhof <Cecil@decebal.nl> |
| Newsgroups | comp.lang.postscript |
| Subject | Re: Putting lines from a file into an array |
| Organization | Decebal Computing |
| References | <87624kp6hc.fsf@Compaq.site.inet> <y7Pus.223533$kt5.184865@fx08.am4> <2012120313202243338-john@acumentrainingcom> <o5jvs.446497$Wc4.79492@fx10.am4> |
| X-Homepage | http://www.decebal.nl/ |
| Date | Tue, 04 Dec 2012 17:17:11 +0100 |
| Message-ID | <87boe9dc6w.fsf@Compaq.site.inet> (permalink) |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:sMStGvM/YWM1biSIw/RP3kRcMlg= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Complaints-To | abuse@xennanews.com |
| Lines | 38 |
| NNTP-Posting-Host | 84.53.123.169 (84.53.123.169) |
| NNTP-Posting-Date | Tue, 04 Dec 2012 17:29:28 +0100 |
| Xref | csiph.com comp.lang.postscript:1142 |
Show key headers only | View raw
Op dinsdag 4 dec 2012 10:09 CET schreef Chris:
> If I were writing it from scratch myself, I would either (assuming we
> know we'd always have a positionable file stream, or that we're allowed
> to use ReusableStreamDecode) not read in the entire file at all, but just
> find and keep the line(s) of interest at a given time.
Well, the way I now want to use it (never know about the future) is
that it is a small file (below 1 KB) and I want to use all the lines.
At the moment all the lines except the last in the same way. But that
properly will change. For example beginning a line with {l}, {r} or
{c} would mean that the line should be left justified, right justified
or centered.
> *Or* I would use (sort of) half of your solution, and use a dictionary as
> the "permanent" storage for the file contents, with the line numbers
> as
Agree, no use converting a dictionary to an array, if you can loop
over both. ;-)
> the keys. In addition, I would have a single, large line buffer which
> gets reused for reading from the file, then I would get the actual length
> of each line, and copy it to a new, correctly sized string. Thus
> minimising redundant memory use.
At the moment I leave the code alone. Done enough with it. But I am
still interested how you would do that? Just to learn the language.
And who knows: when my usage changes, it would maybe become a good
idea to implement it.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-02 21:02 +0100
Re: Putting lines from a file into an array Chris <cjl@spamcop.net> - 2012-12-02 20:47 +0000
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-03 00:52 +0100
Re: Putting lines from a file into an array Don Lancaster <don@tinaja.com> - 2012-12-05 11:58 -0700
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-05 23:19 -0600
Re: Putting lines from a file into an array John Deubert <john@acumentraining.com> - 2012-12-03 13:20 -0800
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-04 00:58 -0600
Re: Putting lines from a file into an array Chris <cjl@spamcop.net> - 2012-12-04 09:09 +0000
Re: Putting lines from a file into an array John Deubert <john@acumentraining.com> - 2012-12-04 07:03 -0800
Re: Putting lines from a file into an array Chris <cjl@spamcop.net> - 2012-12-04 17:46 +0000
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-04 17:17 +0100
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-02 15:31 -0600
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-03 02:19 +0100
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-02 23:28 -0600
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-03 10:01 +0100
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-01 13:25 -0700
Re: Putting lines from a file into an array JohnF <john@please.see.sig.for.email.com> - 2016-08-02 03:39 +0000
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-02 21:58 -0700
Re: Putting lines from a file into an array Tonton Th <tTh@nowhere.invalid> - 2016-08-03 05:10 +0000
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-02 22:20 -0700
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-02 22:35 -0700
Re: Putting lines from a file into an array JohnF <john@please.see.sig.for.email.com> - 2016-08-03 06:21 +0000
Re: Putting lines from a file into an array JohnF <john@please.see.sig.for.email.com> - 2016-08-03 06:32 +0000
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-22 22:31 -0700
csiph-web