Re: Accessing web with a C program
- From: rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos)
- Date: Fri, 09 Feb 2007 11:34:17 GMT
"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
.
- Follow-Ups:
- Re: Accessing web with a C program
- From: Keith Thompson
- Re: Accessing web with a C program
- From: Mark McIntyre
- Re: Accessing web with a C program
- References:
- Accessing web with a C program
- From: Neo
- Re: Accessing web with a C program
- From: Lew Pitcher
- Re: Accessing web with a C program
- From: Christopher Benson-Manica
- Re: Accessing web with a C program
- From: Lew Pitcher
- Accessing web with a C program
- Prev by Date: Re: Undefined Behavior of printf
- Next by Date: Re: IS this a proper way of freeing memory with free()
- Previous by thread: Re: Accessing web with a C program
- Next by thread: Re: Accessing web with a C program
- Index(es):
Relevant Pages
|