![]() |
|
[C] C, Need Help [ Fetch Text From Online ] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] C, Need Help [ Fetch Text From Online ] (/showthread.php?tid=5750077) |
C, Need Help [ Fetch Text From Online ] - 0x0x0 - Nov 9, 2017 Hello, Suppose I have a file online which contains a string of 10 length and I want to get this string into my C program and store it into local variable C. I don't want to use CURL for this. Looking for something windows oriented solution. I found something online for sockets but I couldn't figure it out. So any help please ? Thanks RE: C, Need Help [ Fetch Text From Online ] - SIM-3547942 - Nov 9, 2017 Personally, I would go with libcurl (even on Windows, there is a difference between curl (the client) and libcurl (the library) ), but given the fact you are specifically looking for a WIndows oriented solution: try URLDownloadToFile(W/A) https://msdn.microsoft.com/en-us/library/ms775123.aspx EDIT: This will be more useful for your situation: https://stackoverflow.com/a/12374407 RE: C, Need Help [ Fetch Text From Online ] - 0xDEAD10CC - Nov 9, 2017 (Nov 9, 2017 02:08 AM)migado Wrote: Personally, I would go with libcurl (even on Windows, there is a difference between curl (the client) and libcurl (the library) ), but given the fact you are specifically looking for a WIndows oriented solution: try URLDownloadToFile(W/A) He doesn't want to save to file so InternetReadFile is the proper function (WinInet). And why use curl if he wants it Windows specific? It's going to be better than using a bloated library like curl which was designed for cross platform use. Much easier than Winsock too if you don't need to do anything fancy either so that SO link isn't truly the greatest point of direction. InternetOpen, InternetConnect, HttpOpenRequest, InternetReadFile, InternetCloseHandle RE: C, Need Help [ Fetch Text From Online ] - 0x0x0 - Nov 11, 2017 (Nov 9, 2017 12:10 PM)0xDEAD10CC Wrote: He doesn't want to save to file so InternetReadFile is the proper function (WinInet). And why use curl if he wants it Windows specific? It's going to be better than using a bloated library like curl which was designed for cross platform use. Much easier than Winsock too if you don't need to do anything fancy either so that SO link isn't truly the greatest point of direction. Thanks for pointing me out to the right direction. Working on these functions to get my program up RE: C, Need Help [ Fetch Text From Online ] - SIM-3547942 - Nov 11, 2017 (Nov 9, 2017 12:10 PM)0xDEAD10CC Wrote: He doesn't want to save to file so InternetReadFile is the proper function (WinInet). And why use curl if he wants it Windows specific? It's going to be better than using a bloated library like curl which was designed for cross platform use. Much easier than Winsock too if you don't need to do anything fancy either so that SO link isn't truly the greatest point of direction. Wow, thanks for the heads up. You are right - the use of libcurl probably is a bit too much. This seems like a much better option for his use-case. RE: C, Need Help [ Fetch Text From Online ] - 0xDEAD10CC - Nov 11, 2017 (Nov 11, 2017 03:09 AM)migado Wrote: Wow, thanks for the heads up. You are right - the use of libcurl probably is a bit too much. This seems like a much better option for his use-case. Winsock is kind of a pain too (for something so trivial) unless you need to manipulate the requests on a socket-level, which in most cases for downloading HTTP content, is not very necessary. If you're doing some kind of multicast stuff or things like SSDP, then it might make more sense to have that level of control. |