C++ 制作 json 数据 并 传送给服务端(Server) 的 php

前端之家收集整理的这篇文章主要介绍了C++ 制作 json 数据 并 传送给服务端(Server) 的 php前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

json数据格式,这里举个基础的例子:

      {"name":"LGH"}

在C++里面,我用个函数把特定的数据组合成 json

toJson( json[ result[] = * temp = * temp_1 = * temp_2 = _itoa(count,json, strcat(result, sendMessage(result);自定义函数,传送数据 }

注意我里面的传送函数,选择在里面执行,原因是,由 toJson 返回 char* result 会造成内存溢出,后来这样做,变为可以。

下面是sendMassage() 函数

sendMessage( * PHP?id= url_for_lgh_connect_database[]=PHP?DB=;链接 *x= WCHAR exchange_text_from_url[],exchange_text_from_x[];修改项目的编码为多字节就可以了 LPCWSTR py = LPCWSTR pz = MultiByteToWideChar( ,,x,-,exchange_text_from_x, ); MultiByteToWideChar( ,url_for_lgh_connect_database,exchange_text_from_url, (InternetAttemptConnect() != cout<<功能。<< cout<<<< 文件 winInet 的 API 函数,访问一个链接 (InternetOpenUrl(InternetOpen(x,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL),NULL)== cout<<数据库了。(The information has been sent to Lgh's database.)<< }

猜你在找的C#相关文章