Re: [NEWBIE] [CODE] file_length() and Parsing

From: Jarratt Davis (
Date: 05/11/00

On Thu, 11 May 2000, Sammy Should Use His Whole Name Next Time wrote:
<Some stuff snipped>
> err = fstat(fileno(fp), &sb);
> This should be portable across all systems.  I think I've used it in
> win95/98, slackware and redhat linux (roughly a year old), and probably at
> least one flavor of bsd.
> Sam
Thanks very muchly for pointing that out - I wouldnt have noticed
till I actually tried to compile it on UN*X of someflavour.  My comments
in that file were simply from my poking around in stdio.h in the MSVC5
includes directory and also /usr/include on a reasonably recent version of
FreeBSD.  The old brain isnt working too well at this point in time :P
Next step is to reqrite the parsing system for my ascii files..
My old one read from the files direct which of course is a bad way to go.
Well on my laptop it is anyway :)  My old function that interprets stuff
ImAString ("You enter a large room /(My isnt it bright in here for such a
large indoors room/).  You see a sign that says, /"Welcome adventurer/".")
Now the way this was written it would read in the file byte by byte,
remembering the byte that came before so it could recognise "control"
characters such as /" /( /) as well as (" and ").  What I want to know is
this really the way I have to go or can I do it another way without slow
things down to byte by byte parsing?  Or should I just make my ASCII
system simpler? :)
It also used to handle, among others:
ImANumber 12345
* Hey heres a comment
I guess what Im saying is, what is the most effecient way of parsing stuff
like this that is lumped together as in one whole mob file read into a
buffer?  Not looking for code - just some ideas to kickstart this poor
brain of mine.  Ive been thinking about this for a few days and I cant
think ofmuch.  Just had a brief look through the archives, a few brief
mentions but nothing realy solid enough to be useful to me...
Sorry to be such a pain - once Ive got a direction to aim, I promise you
wont hear a peep out of me till Ive finished it :)  Unless I code myself
into a corner that is :)


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT