opening website

U

Umesh

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;
}
 
B

Ben Pfaff

Umesh said:
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 said:
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..
 
J

Jinsere

The c itself do not support opetations to network.It relay on platform
you used.
 
J

Joachim Schmitz

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

#include"stdio.h"
#include said:
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
 
K

Keith Thompson

Joachim Schmitz said:
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.)
 
G

Guru Jois

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
 
J

Joachim Schmitz

Keith Thompson said:
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
 
C

Christopher Benson-Manica

CBFalconer said:
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.
 
U

Umesh

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.
 
I

Ian Collins

Umesh said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top