GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 19-Jan-2007, 03:00
asenthil asenthil is offline
New Member
 
Join Date: Dec 2006
Posts: 24
asenthil is on a distinguished road

How to read the contents of a webpage and write it to a file?


Hai to all....

i have just now started working in the field of VC++...

So i'm expecting the help of this forum...

Now, i'm having a table in a html webpage namely (1.htm)

Now i want to read the contents of the webpage (ie table) and

write the contents to another file such as image file or doc file...

How shall i do it...

is there any example code available in the net?

Can any one plzz help me for this...

thanks in advance...
senthil.
  #2  
Old 19-Jan-2007, 23:51
asenthil asenthil is offline
New Member
 
Join Date: Dec 2006
Posts: 24
asenthil is on a distinguished road

Re: How to read the contents of a webpage and write it to a file?


Hai to all...

I have searched the websites and tried the following

methods.... But itz not working...

i just want to read the contents of a webpage and write it to another

file... thats y i have choosen the following method....

Code:
HINTERNET Initialize; Initialize = InternetOpen(L"",LOCAL_INTERNET_ACCESS, NULL, 0, 0); Initialize = InternetOpen(L"",LOCAL_INTERNET_ACCESS, NULL, 0, 0); HINTERNET handle = ::InternetOpenUrl(Initialize, L"C:/1.html",NULL, NULL, NULL, NULL); HANDLE hFile= ::CreateFile(L"c:\\tab.jpg", GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); char Buffer[1024]; DWORD dwRead =0; while(::InternetReadFile(handle, Buffer, sizeof(Buffer), &dwRead) == TRUE) { if ( dwRead == 0) break; DWORD dwWrite = 0; WriteFile(hFile, &Buffer, dwRead, &dwWrite, NULL); } CloseHandle(hFile); InternetCloseHandle(handle); InternetCloseHandle(Initialize);

in the html file, there is a table created by html codes...

the above codes just creating a file tab.jpg...

but not writing the contents...

What shall i do for this process..

Can u plzz explain me?

thanks..
senthil.
  #3  
Old 23-Jan-2007, 14:34
killzone killzone is offline
Junior Member
 
Join Date: Nov 2006
Posts: 66
killzone is an unknown quantity at this point

Re: How to read the contents of a webpage and write it to a file?


why did you write initialize twice because you only need to initialize "initialize"; Once.
  #4  
Old 23-Jan-2007, 21:04
asenthil asenthil is offline
New Member
 
Join Date: Dec 2006
Posts: 24
asenthil is on a distinguished road

Re: How to read the contents of a webpage and write it to a file?


oh sorry sorry,

itz just a copy paste problem...

itz initialized only once...

now tell me...

how can i do that...

thanks for ur reply..
senthil.
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:35.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.