Thread: cURL and piping

  1. #1
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    404

    cURL and piping

    For some reason I can't find a development package for cURL for mingw32 so I decided I would just pipe the output to my program, simple enough?

    What I want my program to do is grab some stock information from yahoo's finance service. So I tested out curl to find the right command:
    Code:
    curl "http://download.finance.yahoo.com/d/quotes.csv?s=S&f=sl1d1t1c1ohgv&e=.csv"
    "S",4.44,"9/24/2010","4:00pm",+0.08,4.46,4.47,4.41,31068484
    The output is formatted perfectly for me, as a csv file.

    Then I pipe it to my program, which just cycles through all of the argv's for the time being is this is what I get, COMPLETELY different.

    Code:
    Code:
    #include <stdio.h>
    
    int main (int argc, char *argv[])
    {
        int i;
        printf("argc=%d\n", argc);
        for (i = 0; i < argc; i++)
            printf("%s\n", argv[i]);
        
        return 0;
    }
    OUTPUT:
    Code:
    curl "http://download.finance.yahoo.com/d/quotes.csv?s=S&f=sl1d1t1c1ohgv&e=.csv" | stock.exe
    argc=1
    stock.exe
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100    61    0    61    0     0    435      0 --:--:-- --:--:-- --:--:--   782
    Any ideas?

  2. #2
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    404
    Ah, just learned something new. When you pipe something, it goes into stdin, not argv.
    *Facepalm*

Popular pages Recent additions subscribe to a feed