Why is there a "password:" prompt on the Visual Studio 2010 cmd on this code
(first code) and none on the other code (second code). both are attached.
In the first code, I am calling a function, but nothing is printed to the
text1.txt file.
In the second code, it works fine.
Why is this and how do I fix it? I need to use the main file seperately from
the function.
#include <string>
#include "curl/curl.h"
#include "curl/easy.h"
using namespace std;
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t written;
written = fwrite(ptr, size, nmemb, stream);
return written;
}
CURL *curl;
FILE *fp;
CURLcode res;
long lSize;
char *translated;
void retrieve(string url);
void retrieve(string data){
curl = curl_easy_init();
if(curl) {
fp = fopen("C:\\text1.txt","wb");
curl_easy_setopt(curl, CURLOPT_URL, data);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fp);
}
}#include "sourcetxt.h"
using namespace std;
int main()
{
retrieve("http://www.google.com/finance/historical?q=NYSE:GS");
return 0;
}#include <string>
#include "curl/curl.h"
#include "curl/easy.h"
using namespace std;
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t written;
written = fwrite(ptr, size, nmemb, stream);
return written;
}
CURL *curl;
FILE *fp;
CURLcode res;
long lSize;
char *translated;
void retrieve(string url);
int main(){
curl = curl_easy_init();
if(curl) {
fp = fopen("C:\\text1.txt","wb");
curl_easy_setopt(curl, CURLOPT_URL,
"http://www.google.com/finance/historical?q=NYSE:GS");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fp);
}
}-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html