Find the answer to your Linux question:
Results 1 to 2 of 2
if((update = fopen("http://www.???.com/update/version_update.txt", "r")) == NULL) { printf("Error Opening File.\n"); exit(1); } while( fgets(line_version, sizeof(line_version), update) != NULL ) { printf("%s", line_version); } fclose(update); // *** if i open local ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    84

    [c programing] how to use "fopen" open file on http: !!

    if((update = fopen("http://www.???.com/update/version_update.txt", "r")) == NULL)
    {
    printf("Error Opening File.\n");
    exit(1);
    }

    while( fgets(line_version, sizeof(line_version), update) != NULL )
    {
    printf("%s", line_version);
    }

    fclose(update);

    // *** if i open local file is working.!!

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    fopen() only works on local files.

    Doing network things is a whole different universe that the basic C library knows nothing about. If you want to open remote files, you either need to write it yourself (using sockets and low-level network calls) or find a library that somebody else has written that makes it simple to work with remote files over HTTP.
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...