Convert command line cURL to C cURL Convert command line cURL to C cURL curl curl

Convert command line cURL to C cURL


At FOSDEM 2015, the writer of curl -Daniel Stenberg- showed me a nice example using the libcurl option:

curl http://example.com --libcurl example.c

As you can guess you can find the full code (incl. handler and cleanup) in example.c


STARTUPINFO si = { sizeof(STARTUPINFO) };PROCESS_INFORMATION pi;TCHAR tempCmdLine[MAX_PATH];_tcscpy_s(tempCmdLine, MAX_PATH, _T("curl.exe http://localhost:8983/solr/update/extract?literal.id=doc2&uprefix=attr_&fmap.content=attr_content&commit=true -F myfile=@doc.pdf"));CreateProcess(NULL, tempCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);

You may want to check the return value of CreateProcess.