DO NOT DEAL WITH THIS MEMBER
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
Nov 9, 2017 02:08 AM
(This post was last modified: Nov 9, 2017 02:12 AM by SIM-3547942.)
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
Nov 9, 2017 12:10 PM
(This post was last modified: Nov 9, 2017 12:16 PM by 0xDEAD10CC.)
(Nov 9, 2017 02:08 AM)SIM-3547942 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)
https://msdn.microsoft.com/en-us/library/ms775123.aspx
EDIT: This will be more useful for your situation:
https://stackoverflow.com/a/12374407
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
DO NOT DEAL WITH THIS MEMBER
(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.
InternetOpen, InternetConnect, HttpOpenRequest, InternetReadFile, InternetCloseHandle
Thanks for pointing me out to the right direction. Working on these functions to get my program up
(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.
InternetOpen, InternetConnect, HttpOpenRequest, InternetReadFile, InternetCloseHandle
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.
Nov 11, 2017 06:47 PM
(This post was last modified: Nov 11, 2017 06:47 PM by 0xDEAD10CC.)
(Nov 11, 2017 03:09 AM)SIM-3547942 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.
|