online data

Started by
6 comments, last by oddbot 19 years, 5 months ago
I can easily load a text file from the hard drive(fopen in C). Now how do I load a text file from a web url like http://www.somedomain.com/sometext.txt ? -CProgrammer
Advertisement
Well, you could do it in C via CGI if you want. Search for CGI programming with C or C++. OR, you could use Python, PHP, Perl, JSP, ASP.. etc etc.


Since you already now C, using CGI is probably the easiest route to take (assuming your server supports CGI). Opening a file via C using CGI is the same as opening a file with just C.


Thanks for the swift reply.
Well I already know some cgi programming but I dont want a server spplication. I want to make a noral windows application which uses the internet connection present to load the file.

-CProgrammer
That would require you to write a socket layer in your application. The layer needs to open a connection on port 80 to the webserver and post a HTTP GET request to get the file/page from the server.

Toolmaker

I see. Thanks. So Ill just check out windows sockets.

-CProgrammer
http-get is one of the smallest pieces of code I know of to get a URL "from scratch".

enum Bool { True, False, FileNotFound };
Wow, thats short for something like getting a file off the web?
Ok maybe some kind of free library? or can WinSock do this if so anyone have a tutorial?
Basically I want to be able to load any file in binary and text mode. Just like C File I/O.

-CProgrammer
Try libcurl


Tutorial here


-oddbot

This topic is closed to new replies.

Advertisement