3
votes

I've never done any curl before so am in need of some help. I've tried to work this out from examples but cannot get my head around it!

I have a curl command that I can successfully run from a windows command line that index pdf file in Solr.

I would need to incorporate this curl command in a C clinet.

How can I translate this curl command so that it works in a C cURL client?

curl "http://localhost:8983/solr/update/extract?literal.id=doc2&uprefix=attr_&fmap.content=attr_content&commit=true"" -F "[email protected]"

2
Do you intend to call the cURL executable from your C client, or to use libcurl?Daniel Gehriger
Yes I intended to call cURL executables from my C client.prasad

2 Answers

11
votes

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

-1
votes
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 [email protected]"));
CreateProcess(NULL, tempCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);

You may want to check the return value of CreateProcess.