How can I use a text file from the internet in my C program? -
i'm working on project, , made c program reads date, time, , wave height .txt file stored on computer, converts date , time gps time use @ scientific research institution, , outputs gps time , wave height screen. however, text file working stored @ http://www.ndbc.noaa.gov/data/realtime2/spll1.txt . there way have c program open text file web address rather local hard drive?
fyi: access file on computer used fopen , interact data contained used combination of fgets , fscanf.
it more involved web-resource read file disk, can absolutely it, example using library such libcurl.
an alternative strategy make components , tie them bash
or other scripting. c program example read standard input, , make bash
script this:
curl http://www.ndbc.noaa.gov/data/realtime2/spll1.txt | ./the_program
this way, keep core c program simpler.
Comments
Post a Comment