[ale] File streams on URL - clarification
Kalin Nakov
knakov at nemetschek.bg
Thu Oct 28 06:47:32 EDT 1999
I wrote:
Hi. I have the following question. Are there any libraries for
opening/reading/writing/closing a file form an http/ftp/gopher... etc. URL?
I would like something like this:
url network_file("http://mysite.com/myfile.txt");
url.read(&data, 10);
url.read(&data, 15);
...
url.close();
Clarification: I want this library to be for C/C++ and also the library
should accept any URL without difficulty, i.e. local files, remote files
over http, ftp, etc., just like the Java java.net.URL class or the Win32
URL moniker. I want the following code translated for use in UNIX with
C/C++:
Java:
try {
URL url = new URL("ftp://ftp.mysite.com/myfile.txt");
InputStream input = url.openStream();
}
catch (Exception e) {
}
Win32 API:
IMoniker *pmkrRemote = NULL;
IBindCtx *pbctxBinder = NULL;
IStream *pstmInput = NULL;
CreateURLMoniker(NULL, L"ftp://ftp.mysite.com/myfile.txt", &pmkrRemote);
CreateBindCtx(0, &pbctxBinder);
pmkrRemote->BindToStorage(pbctxBinder, NULL, IID_IStream, (PVOID*)
&pstmInput);
Thanks in advance.
More information about the Ale
mailing list