[Gdal-dev] RFC 7: API Change for the VSIxxxL family of file
functions
Ray Gardener
rayg at daylongraphics.com
Wed Nov 1 17:47:56 EST 2006
> I see. After looking at what VSIVirtualHandle provides, and what the
> drivers in frmts and ogr need, what seems to be missing is
> equivalent functionality to fgets, fgetc, ungetc, fprintf and fscanf.
> The first three would be fairly trivial to add, but the next two ...
fprintf can be handled with:
int our_fprintf(our_file_t stream, const char* pszFormat, ...)
{
va_list argList;
va_start(argList, pszFormat);
int n;
if(stream.small())
n = vfprintf(stream.filep, pszFormat, argList);
else
{
char sz[max_printf_len + 1]; // todo: unsafe
n = vsprintf(sz, pszFormat, argList);
large_file_write(stream.file, sz, n);
}
va_end(argList);
return n;
}
fscanf is admittedly non-trivial but there's open source to the rescue.
If you grab, e.g.,
http://gentoo.osuosl.org/distfiles/avr-libc-1.2.6.tar.bz2
it has open source implementations of CRT that you can borrow from.
Their licence states:
"The contents of avr-libc are licensed with a Modified BSD License.
All of this is supposed to be Free Software, Open Source, DFSG-free,
GPL-compatible, and OK to use in both free and proprietary applications."
Ray
More information about the Gdal-dev
mailing list