FILE* tsmOpenStream ( char const *url, char const *access_mode ) Open an http or local filesystem I/O stream
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:
- http://www.ai.sri.com/~magic/tsmApi/index.html
- file://localhost/~user/foo.txt
- /homedir/user/files/foo
- ~user/tmp/foo.doc
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.