opening website

Discussion in 'C Programming' started by Umesh, Jun 5, 2007.

  1. Umesh

    Umesh Guest

    how to open a website like yahoo.com and use it as input? The
    following code doesn't work.

    #include"stdio.h"
    int main()
    {

    FILE *f;
    f=fopen("http://www.yahoo.com","r");
    if(f==NULL)
    puts("Error opening file");
    return 0;
    }
     
    Umesh, Jun 5, 2007
    #1
    1. Advertising

  2. Umesh

    Ben Pfaff Guest

    Umesh <> writes:

    > how to open a website like yahoo.com and use it as input?


    The standard C language and library don't provide a way. I
    suggest that you look for an implementation-specific solution in
    a newsgroup specific to your environment.

    > #include"stdio.h"


    Should be #include <stdio.h>.

    > int main()


    It's better to write function declarations in prototype form:
    int main(void)

    > {
    >
    > FILE *f;
    > f=fopen("http://www.yahoo.com","r");
    > if(f==NULL)
    > puts("Error opening file");


    Normally this function call would have indentation beyond that of
    the if statement..

    > return 0;
    > }

    --
    Comp-sci PhD expected before end of 2007
    Seeking industrial or academic position *outside California* in 2008
     
    Ben Pfaff, Jun 5, 2007
    #2
    1. Advertising

  3. Umesh

    flyreally Guest

    On 6 5 , 12 29 , Umesh <> wrote:
    > how to open a website like yahoo.com and use it as input? The
    > following code doesn't work.
    >
    > #include"stdio.h"
    > int main()
    > {
    >
    > FILE *f;
    > f=fopen("http://www.yahoo.com","r");
    > if(f==NULL)
    > puts("Error opening file");
    > return 0;
    >
    >
    >
    > }- -
    >
    > - -


    i'm a Chinese student, my msm ID is :, could you
    please add me as your fiend??
     
    flyreally, Jun 5, 2007
    #3
  4. Umesh

    Jinsere Guest

    The c itself do not support opetations to network.It relay on platform
    you used.
     
    Jinsere, Jun 5, 2007
    #4
  5. Umesh

    Albert Lee Guest

    On 6 5 , 2 19 , Jinsere <> wrote:
    > The c itself do not support opetations to network.It relay on platform
    > you used.


    take a look at lib curl.
     
    Albert Lee, Jun 5, 2007
    #5
  6. "Umesh" <> schrieb im Newsbeitrag
    news:...
    > how to open a website like yahoo.com and use it as input? The
    > following code doesn't work.
    >
    > #include"stdio.h"

    #include <stdio.h>

    > int main()
    > {
    >
    > FILE *f;
    > f=fopen("http://www.yahoo.com","r");

    fopen is for opening a file stream, not a network connection.
    Opening network connections is not topical here, try comp.unix.programmer.

    > if(f==NULL)
    > puts("Error opening file");

    fputs(stderr, "Error opening file");

    error messages should go to stderr, not stdout

    > return 0;
    > }


    Bye, Jojo
     
    Joachim Schmitz, Jun 5, 2007
    #6
  7. "Joachim Schmitz" <> writes:
    > "Umesh" <> schrieb im Newsbeitrag
    > news:...

    [...]
    >> f=fopen("http://www.yahoo.com","r");

    > fopen is for opening a file stream, not a network connection.
    > Opening network connections is not topical here, try comp.unix.programmer.


    The standard says very little about how file names are interpreted.
    An implementation could easily support URLs as file names. (I know of
    none that do so.)

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Jun 5, 2007
    #7
  8. Umesh

    Guru Jois Guest

    On Jun 4, 9:29 pm, Umesh <> wrote:
    > how to open a website like yahoo.com and use it as input? The
    > following code doesn't work.
    >
    > #include"stdio.h"
    > int main()
    > {
    >
    > FILE *f;
    > f=fopen("http://www.yahoo.com","r");
    > if(f==NULL)
    > puts("Error opening file");
    > return 0;
    >
    > }



    try using 'wput' . See man page for more info, or mail help to

    hagen (at) itooktheredpill.dyndns.org

    He might help you in this regards,

    Bye

    Guru Jois
     
    Guru Jois, Jun 5, 2007
    #8
  9. "Keith Thompson" <> schrieb im Newsbeitrag
    news:...
    > "Joachim Schmitz" <> writes:
    >> "Umesh" <> schrieb im Newsbeitrag
    >> news:...

    > [...]
    >>> f=fopen("http://www.yahoo.com","r");

    >> fopen is for opening a file stream, not a network connection.
    >> Opening network connections is not topical here, try
    >> comp.unix.programmer.

    >
    > The standard says very little about how file names are interpreted.

    True

    > An implementation could easily support URLs as file names. (I know of
    > none that do so.)

    Umesh's implementation apparently doesn't either.

    Bye, Jojo
     
    Joachim Schmitz, Jun 5, 2007
    #9
  10. Guru Jois said:

    <snip>

    > try using 'wput' .


    There is no wput function in C. Please learn C before trying to teach
    it.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at the above domain, - www.
     
    Richard Heathfield, Jun 5, 2007
    #10
  11. CBFalconer <> wrote:

    > wput is non-standard. I don't object to the mention, I do object
    > to not so-identifying it.


    It also doesn't seem to be ubiquitous enough to merely refer a
    potential user to the man page.

    --
    C. Benson Manica | I *should* know what I'm talking about - if I
    cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, Jun 6, 2007
    #11
  12. Umesh

    Umesh Guest

    May I automatically open a web page and save it as a text file to c:
    \1.txt and then email it through outlook? Which language should I use?
    Please guide me. Thank you in anticipation.
     
    Umesh, Jun 9, 2007
    #12
  13. Umesh

    Ian Collins Guest

    Umesh wrote:
    > May I automatically open a web page and save it as a text file to c:
    > \1.txt and then email it through outlook? Which language should I use?
    > Please guide me. Thank you in anticipation.
    >

    Something other than C. Goodbye.

    --
    Ian Collins.
     
    Ian Collins, Jun 9, 2007
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. yburtin
    Replies:
    2
    Views:
    638
    yburtin
    Oct 26, 2004
  2. Replies:
    0
    Views:
    303
  3. Padmalatha

    Error in opening the website application

    Padmalatha, Dec 16, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    529
    Michael Nemtsev [MVP]
    Dec 17, 2007
  4. ton
    Replies:
    0
    Views:
    363
  5. fniles
    Replies:
    0
    Views:
    279
    fniles
    Apr 26, 2009
Loading...

Share This Page