如何使用c打开文件 [英] How to open the file using c
本文介绍了如何使用c打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows环境下工作.
我尝试以以下方式打开文件.但是文件句柄给出了空值
代码:
i am working under windows environment.
i try to open the file in following manner. but file handle gives null values
code:
FILE * fp = fopen("http://SomeIp//filename.txt", "r");
它给出空值.
您能否建议使用其他方法使用http ..
it gives null values.
can you suggest any other way to read the file using http..
推荐答案
尝试从MS读取此代码:
http://support.microsoft.com/kb/149413 [
try this code from MS:
http://support.microsoft.com/kb/149413[^]
您可以使用fopen()打开本地文件,也可以使用远程( nfs)仅挂载文件,而不包含http内容,要获取http内容,您需要建立与http服务器("SomeIp")的TCP连接,然后在该连接上写入http请求,然后http服务器将用以下命令回复所需的内容.
为此,您可以使用 boost (C ++)或 libcurl (C).祝你好运
You can use fopen() to open local files, or remote (nfs) mounted file only, but not a http content, To get http content, you need to make a TCP connection to http server("SomeIp"), and than write a http request on that connection, than http server will reply back with desired content.
To implement this you can use boost(C++) or libcurl(C). Good Luck
每当我想要获取HTTP实体时,我都会到达 libcurl [ ^ ].它只会读取您似乎要访问的类型的顺序访问.
Whenever I want to GET an HTTP entity I reach for libcurl[^]. It''ll do read only sequential access of the type you seem to be after.
这篇关于如何使用c打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文