Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!ginosko!brutus.cs.uiuc.edu!apple!bloom-beacon!eru!luth!sunic!mcsun!ukc!stc!datlog!gis From: gis@datlog.co.uk ( Ian Stewartson ) Newsgroups: comp.lang.c Subject: Re: fgetpos, fsetpos, and ANSIness in general Message-ID: <2252@dlvax2.datlog.co.uk> Date: 13 Oct 89 07:24:04 GMT References: Reply-To: gis@datlog.co.uk ( Ian Stewartson ) Organization: Data Logic Ltd, Queens House, Greenhill Way, Harrow, London. Lines: 34 In article otto@tukki.jyu.fi (Otto J. Makela) writes: (edited) >For example, I like the idea behind strftime, the date formatting routine ala >printf. But I dislike the interface: the more-or-less Unix tradition for such >functions is to return a pointer to a fixed buffer. > >Now, this interface could be extended for this: define that the function will >use a internal buffer of, er, let's say 80 characters IF the buffer pointer >given is NULL. Function returns zero, as originally, if the buffer length is >exceeded. This way, you get the best of both implementation ideas. Nothing >like this was not done. Why ? One of the major problems with the world today is that we don't all speak English as our first (and only) language and format our dates the way the British (as opposed to any other 'english' speaking nation) do. Indeed, some governments and nations insist that computer software speaks their language and date formats. And even the British can't make up their mind. Therefore, when you pass a format to strftime, how do it now how big the resultant string is going to be. Well it doesn't, so to put the responsibility for any problems in the right place, you have to pass a buffer and length. I believe the reasons for this are very similar to the reasons for using fgets instead of gets. Strftime was designed to implement National Language Support which it does quite sensibly (especially when you compare it with the original nl_ascxtime and nl_cxtime). Regards, Ian Stewartson Data Logic Ltd, Queens House, Greenhill Way, Harrow, Middlesex, HA1 1YR, UK. (Phone) +44 1 863 0383 (Telex) 888103 (Fax) +44 1 861 2010 +44 81 863 0383 after May 1990. (Network) gis@datlog.co.uk or ukc!datlog!gis