Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading file from internet 1

Status
Not open for further replies.

codessoft

Programmer
Sep 23, 2003
6
NP
Dear all,
I am new to Tek-tips member.
i have a small problem with file reading from internet.
i have a web site and i uploaded a DAT file this DAT file record some data from user. peoblem is this i create tool for direct access my dat file but its doesn't work only html file is display.

my i did like this...
-------------------------------------------
void CHtmlViewDlg::DisplayData(CString strUrl)
{
BeginWaitCursor();
CInternetSession session;
CInternetFile* pFile=(CInternetFile*)session.OpenURL(strUrl);
if(pFile)
{
CString strData;
CString totalData;
pFile->SetReadBufferSize(4096);
while(pFile->ReadString(strData))
{
totalData=totalData+strData+"\r\n";
}
EndWaitCursor();
SetDlgItemText(IDC_DATA,totalData);
pFile->Close();
}

}
how can is a read my Dat file and other file please help.
 
>> but its doesn't work only html file is display.

What html file?
What is the HTTP reply code?
Welcome to Tek-Tips [cheers]


-pete
 
You can use MSHTML to parse the resulted HTML

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
hi both,
i mean my program read only .html file not other files.
why other file can't read properly.
please suggest again.
if you want to test this program you can download from this link please test and suggest me.
i am waiting.
 
I am not going to keep repeating my questions. What is the HTTP reply code?


-pete
 
Thanks palbano,
abslutly answer is TEXT.
but my dat file also text.
you mean extension?

please....
 
I think there is something about configuration of HTTP server what does not allow you to read everithing.

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
>> you mean extension?

No the HTTP Reply Code, see the documentation for CHttpFile::QueryInfoStatusCode()

This Reply Code contians information as to the "why" of the failure.

-pete
 
hi both,
thanks for your cooperation.
its mean not posible, is it?
i want to aske you litlebit defrent question?
i think this is stranger please pardon me.
we laounch new web site 2 week befor.
our web site name is - there is all asp files
one is default.asp file problem is this when i access this file like this " my program showing all html codes and text but not asp codes.
--------------------------------
why asp codes doesn't display?
yeah you already told me, this is couse by dwStatusCode.
its mean only hyper text markup language is posible , is it?

thank u?
 
because they are executed on the server, and result is erturnet through HTTP as HTML page. By the way, ASP means Active Server Pages.

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
"You never create a CInternetFile object directly. Instead, create an object of one of its derived classes by calling CGopherConnection::OpenFile or CHttpConnection::OpenRequest. You also can create a CInternetFile object by calling CFtpConnection::OpenFile."
-------------------------------------------------------

The above is taken from MSDN...

Now, also a .dat file may not be recognized by the HTTP server so u will probably have to set the MIME-TYPE on the server in order to recognize as TEXT or simpy you could change the DAT file to extension .txt or .html

In order for you to see the ASP code you need to download the original document through FTP or something - if you try to get it through HTTP the server will parse the document and return HTML.

Rocco is the BOY!!

SHUT YOUR LIPS...
ROCCOsm.gif
 
hello all,
thsnks for cooperation.
now i understood cleraly.
its mean posiblity is 0.
please if you know any type posoblity please refer me.
thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top