View Single Post
Old 03-09-2005, 07:14 PM   #1 (permalink)
robertfoley
Registered User
 
Join Date: Mar 2005
Posts: 1
robertfoley is on a distinguished road
Unhappy Copy a remote file

Hi there,
I was wondering if any of you gurus can help me with this. I am new to C++ and am developing on MicroSoft Visual Studio 2003 (Visual C++).
I am trying to simply read a file from a webserver and save it locally. My code works when I copy the file from a local location but throws a null pointer when I give the url of the file.

+++++++++++++++++++++++++++++++++++++++++++++++
FILE* fp1 = fopen("http://192.100.53.90/DimensionView/booking_info.txt","r");
FILE* fp2 = fopen("C:\\booking_info.txt","w");

while(!feof(fp1)) {
char mystring[100];
fgets(mystring, 100, fp1);
//fputs(fp2,*mystring,strlen(*mystring));
fputs(mystring, fp2);
}
fclose (fp1);
fclose (fp2);
++++++++++++++++++++++++++++++++++++++++++++++++

Is it that fopen is can only be used to obtain a pointer to local files only? I have searched and searched but cannot find how to read a remote file (rfopen? )

Any help would be great.

Thanks,
Rob
robertfoley is offline   Reply With Quote