Re: Accessing web with a C program



"Lew Pitcher" <lpitcher@xxxxxxxxxxxx> wrote:

On Feb 8, 3:40 pm, Christopher Benson-Manica
<a...@xxxxxxxxxxxxxxxxxxx> wrote:
Lew Pitcher <lpitc...@xxxxxxxxxxxx> wrote:
You /should/ be able to
FILE *web = fopen("http://google.com/","r";);
and have a valid read connection to the named web page.

Should? I'm curious, what argues for this behavior? I certainly
wouldn't expect it from fopen() regardless of whether it was commonly
implemented or not.

What sort of behaviour would you expect from
FILE *somefile = fopen("C:\\ABC\\DEF\\GHI.J","r");
or
FILE *somefile = fopen("DDNAME:SYSIN,"r");
or
FILE *somefile = fopen("/a/b/c.d","r");

I'd expect it to open a local file.

This is very different from opening a URL, because that involves making
a connection to a random machine on the 'net, and possibly getting the
user to enter dialing passwords and all.

What's different (wrt how fopen() is defined in the standard, or how
it is used in real life) betwen these usages and the usage I suggest?

What's different between

cat /home/bloggsj/agenda

and

cat http://www.google.com/

entered on a normal Unixoid command line?

What is your objection to
FILE *web = fopen("http://google.com/","r";);

I have no objection to it /per se/; but I do think that claiming that
you _should_ be able to do it is short-sighted. It would be a nice
enhancement in those environments where it makes sense; but it's hardly
a life-saver, and there are enough snags to it that it can hardly be
expected of most systems.

Richard
.



Relevant Pages

  • Re: Hate to give up
    ... cat /etc/resolv.conf ... we have a usb modem on it's frame there are ... one keeps flashing continuesly as if it is there is a connection (but no ... nameserver 207.69.188.185 ...
    (Ubuntu)
  • Re: HDTV etc hookup
    ... In the media room I am getting more and more stuff that needs to be ... It probably depends on what type of high speed connection you have. ... connect the various things there with cat 5 or cat 6 cable. ... connect the computer to the router through the wireless facility. ...
    (alt.tv.tech.hdtv)
  • Re: DSC 864 Serial Cable Length
    ... from the alarm panel to the room I have the pc in. ... | This is what I did as I already had the PCLink panel connection to work ... make a cat 5e cable. ... | · I connected the wires at the cat 5e jack as usual. ...
    (alt.security.alarms)
  • Re: Accessing web with a C program
    ... Mark McIntyre wrote: ... and have a valid read connection to the named web page. ... what argues for this behavior? ...
    (comp.lang.c)
  • Re: Hate to give up
    ... cat /etc/resolv.conf ... we have a usb modem on it's frame there are ... one keeps flashing continuesly as if it is there is a connection (but no ... numbers pppconfig reverts back to static, After pon dials the provider ...
    (Ubuntu)