百度地图API逆地址服务

来源:互联网 发布:淘宝怎样避开查假 编辑:程序博客网 时间:2024/06/02 12:49
   AnsiString g_Url="http://api.map.baidu.com/geocoder/v2/?ak=Xd93xc2ZCCtiaWZiIj7wuqxL&callback=renderReverse&location=29.91891,121.79954&output=json&pois=0";    TMemoryStream *ms=new  TMemoryStream;        IdHTTP1->Get(g_Url,ms);//g_Url是网页网址    const int msSize=ms->Size;    LPSTR lpBuf=new char[msSize];    ms->Position=0;    ms->Read(lpBuf,msSize);    delete ms;    String const strText=String(lpBuf,msSize);    delete [] lpBuf;       Memo1->Text =Utf8ToAnsi(strText);
百度API可返回json和XML格式的数据,都是UTF-8编码,注意最后用Utf8ToAsni函数转为char字符串
0 0
原创粉丝点击