Author | Post | ||
davs |
Hi all, Does anybody know how to load some text from web using C programm language? For example we have some site (www.somesite.com/sometext.php) with text "This is some text" and we wish to print that text in console application or we wish to use that text in some array for example! Thx! |
||
20.01.2008 18:51:25 |
|
||
unknown user |
you will notice that this isn't as trivial, as you probably came to expect anyway there are many ways to do this, and many libraries. But to do it the bare C way would be with berkley sockets on linux, and with winsock on windows. this is a short illustrtion of how to write a socket client application using the berkley sockets http://analyser.oli.tudelft.nl/beej/translations/net/html/client.c winsock example can be googled to this location: http://www.sockaddr.com/GetHTTP.zip the examples are a bit different, but basically they follow the same pattern, and usually you would just #ifdef your code to switch between the winsock api, and the berkley sockets. However to solve challenges, I barely ever use sockets in cpp. I just use wget, and tie it together with some bash. There are libraries, who wrap all the code in the above example to similar syntax as in VB or other higher level languages, might want to try a few of those. I'm only familiar with the c++ libraries which have this functionality. |
||
20.01.2008 19:56:50 |
|