FILE* tsmOpenStream ( char const *url, char const *access_mode )

Open an http or local filesystem I/O stream

Documentation

Open an http or local filesystem I/O stream.

This function can be used to open a stream for a file, where the file can be an http URL, a file URL, or a localdisk filename. The function returns a standard FILE * stream that can use operated on by any of the stdio functions, e.g. fread, fgetc, etc. For example, valid urls including:

The access_mode parameter can be used to specified whether you want to read, write, append, etc the file. For localdisk files then this string can be any of those supported by fopen(3), e.g. "r", "w", "a", etc. For http files, the only valid access_mode string is "r". That is, you can only read from an http server, not write to it.

Once you have finished using the stream, you should close it using the tsmCloseStream() call (unless you use a function which closes the stream for you).

This function was basically designed to behave exactly the same as fopen for localdisk files, whilst also providing support for opening files that are located on a remote http server.

Returns:
a FILE * stream if all went well, or NULL if an error occurred
Parameters:
url - an http or localdisk url to be opened
access_mode - one of "r", "w", "a", etc. N.B. only "r" for http.
Author:
Martin Reddy
Version:
1 May 1998
See Also:
tsmCloseStream, tsmStreamToFile, tsmStreamToBuffer, tsmStreamToStdout


TSMAPI_RELEASE 2.1 - Release Date: 2001/01/10 19:01:12

Back to tsmApi Home Page