|
-
November 21st, 2008, 02:57 AM
#1
lines of code not processing in sequential order
this is not really a big problemo, but its making my brain itch. I'm trying to figure out why the program displays the cout << "downloading source..." line after processing the CurlGetUrl() function. the program takes the cin input then waits while grabbing the url then just displays instantaneously all the text output at once
sorry if this is a dumb question, i'm just learning c++, and I did do a search of the forums already but didn't see any explanation for this
Code:
int main(void) {
CurlSetCookieFile("./cookie.jar");
double quote;
int returnvalue;
string sPage;
string ticker;
string urlcombo;
char *url1 = "http://quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=";
char *url2 = "&selected=";
cout << endl << "QUOTE PARSER" << endl << "============" << endl << endl;
do {
cout << "Enter ticker (or quit):";
cin >> ticker;
if (ticker=="quit") break;
cout << endl << "downloading source...";
urlcombo = url1 + ticker + url2 + ticker;
returnvalue = CurlGetUrl(urlcombo.c_str(), &sPage);
if (returnvalue) {
cout << "done!" << endl << "parsing quote data...";
quote = parsefloat1(sPage, "lastsale");
cout << "done!" << endl;
cout << ticker << "=$" << quote << endl << endl; }
else cout << endl << "url error!" << endl; }
while (ticker!="quit");
FreeCurlLibrary();
return 0; }
-j
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|