open txt file form web or ftp ?
-
Hello sry for may bad english im a Austrian Ok now my question I have a litle Prog witch opens a txt file from my local hdd, now i want to open a txt file from my web serv and put it out on te consol. But how can i open the file ? it doesn't work ptr = fopen("\\http://king.ath.cx//server.txt" ,"r+"); if(ptr == NULL) { printf("\nfopen error\n"); getchar(); Lg Alex
-
Hello sry for may bad english im a Austrian Ok now my question I have a litle Prog witch opens a txt file from my local hdd, now i want to open a txt file from my web serv and put it out on te consol. But how can i open the file ? it doesn't work ptr = fopen("\\http://king.ath.cx//server.txt" ,"r+"); if(ptr == NULL) { printf("\nfopen error\n"); getchar(); Lg Alex
-
Hello sry for may bad english im a Austrian Ok now my question I have a litle Prog witch opens a txt file from my local hdd, now i want to open a txt file from my web serv and put it out on te consol. But how can i open the file ? it doesn't work ptr = fopen("\\http://king.ath.cx//server.txt" ,"r+"); if(ptr == NULL) { printf("\nfopen error\n"); getchar(); Lg Alex
I can say one of old style of coding (not a .net style, I'm saying) with WinInet. The primary usage is thus; <pre> HINTERNET hInet = InternetOpen("MyLocalAgent", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); HINTERNET hFile = InternetOpenUrl(hInet, "http://king.ath.cx/server.txt", NULL, 0, 0); BYTE buffer[BUFSIZE]; DWORD dwRead; while (InternetReadFile(hFile, buffer, BUFSIZE, &dwRead)) { if (0 == dwRead) break; fwrite(buffer, 1, dwRead, stdout); } InternetCloseHandle(hFile); InternetCloseHandle(hInet); </pre>
-
Hello sry for may bad english im a Austrian Ok now my question I have a litle Prog witch opens a txt file from my local hdd, now i want to open a txt file from my web serv and put it out on te consol. But how can i open the file ? it doesn't work ptr = fopen("\\http://king.ath.cx//server.txt" ,"r+"); if(ptr == NULL) { printf("\nfopen error\n"); getchar(); Lg Alex
You could either open it using a UNC path, or try using
URLDownloadToFile()
."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
Hello sry for may bad english im a Austrian Ok now my question I have a litle Prog witch opens a txt file from my local hdd, now i want to open a txt file from my web serv and put it out on te consol. But how can i open the file ? it doesn't work ptr = fopen("\\http://king.ath.cx//server.txt" ,"r+"); if(ptr == NULL) { printf("\nfopen error\n"); getchar(); Lg Alex
-
You could use
CInternetSession
,CSdioFile
,CHttpFile
andCInternetFile
MFC classes to read data from remote file based on HTTP and FTP protocols.Life is a stage and we are all actors!
-
You could either open it using a UNC path, or try using
URLDownloadToFile()
."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
but URLDownloadToFile() cannot down the LAN's web server ,like this : http://192.168.1.200/myfree.txt :)