That is atrocious. The person who wrote that did not understand what they were doing, or very likely, have any experience with either C or C++. Only a truly sick mind would think of using sprintf() that way. Horrible. Really, really bad code.
The HTTP part is potentially correct, as long as you are sending a pure text file. Here's the RFC:
RFC 2388 - Returning Values from Forms: multipart/form-data
If you do some googling and reading on the nature of HTTP requests and specifically requests with a Content-Type of 'multipart/form-data', this is fairly straightforward. Using a tcp/ip socket is a separate issue, but there must be a million easy found tutorials, etc, on the topic for any platform.
And as Salem said, that's mostly C. The parts you did not show may have more C++ in them -- who knows? Since you did not include the declaration of any of the variables, there's not much any one can do to help you with that.