C语言或者C++如何调用一个http接口并得到返回结果?

Python014

C语言或者C++如何调用一个http接口并得到返回结果?,第1张

用jni

首先

java

public

class

testhello

{

static

{

system.loadlibrary("testhellos")

}

public

static

native

void

hello(string

msg)

public

native

void

getsysid()

public

native

string

getkeycode(string

sysid)

public

native

boolean

testkeycode(string

sysid,

string

keycode)

public

static

void

main(string[]

args)

{

//

hello("hello,kimm!")

testhello

t=

new

testhello()

t.getsysid()

}

}

用javac

testhello.java,

java

testhello,javah

-classpath

.

-verbose

testhello

。将生产的头文件用到c++

中的

heardfileds

中。然后在

sources

files

中实现

heardfieds

方法。实现的方法,其实就是你要调用c++的方法、

去看一下《Advanced Linux Programming》这本书吧,第11章讲的就是怎么用C语言实现一Http服务器。 这里有下载地址(英文的): http://www.advancedlinuxprogramming.com/alp-folder 英文看起来不顺的话可以上网找找有没有中文版的这本书,应该叫Linux高级编程吧~~~参考资料: http://www.advancedlinuxprogramming.com/alp-folder