Click here to Skip to main content
15,910,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Retrieve the file names from a dir? Pin
Jörgen Sigvardsson15-Dec-02 4:27
Jörgen Sigvardsson15-Dec-02 4:27 
GeneralRe: Retrieve the file names from a dir? Pin
Ted Ferenc15-Dec-02 4:30
Ted Ferenc15-Dec-02 4:30 
GeneralTypo Pin
Ted Ferenc15-Dec-02 4:32
Ted Ferenc15-Dec-02 4:32 
GeneralRe: Retrieve the file names from a dir? Pin
Rickard Andersson2015-Dec-02 6:15
Rickard Andersson2015-Dec-02 6:15 
GeneralProxy Scanner Pin
Trin214-Dec-02 22:20
Trin214-Dec-02 22:20 
GeneralRe: Proxy Scanner Pin
l a u r e n15-Dec-02 3:34
l a u r e n15-Dec-02 3:34 
GeneralRe: Proxy Scanner Pin
Taka Muraoka15-Dec-02 4:04
Taka Muraoka15-Dec-02 4:04 
GeneralCFile Question Pin
John Clump14-Dec-02 20:09
John Clump14-Dec-02 20:09 
Hi everyone. I have a question about the use of CFile. I have the code below, and the filename is that of a file which I have tested and determined exists, and is not shared. The file is an HTML file, and I want to take the contents of the HTML file (the text), and put it into a CString. The string will then be parsed and the hyperlinks extracted.

<br />
CFile cFile;<br />
CString strFileContents;<br />
<br />
cFile.Open(m_strFileName, CFile::modeRead | CFile::shareExclusive);<br />
cFile.Read(&strFileContents, cFile.GetLength());<br />
cFile.Close();<br />


The problem with the code above is that when the Read is performed, the program crashes. I tried using an old style C string in place of a CString, the data is read but a bunch of garbage chars are at the end of the string, and the program crashes when I hit Close(). Anyone know what I am doing wrong? I really want the file contents in a CString, because the necessary memory is allocated dynamically, and the CString Find functions are great for parsing.
GeneralRe: CFile Question Pin
Trin214-Dec-02 22:13
Trin214-Dec-02 22:13 
GeneralRe: CFile Question Pin
Dudi Avramov14-Dec-02 23:16
Dudi Avramov14-Dec-02 23:16 
QuestionCSimpleArray ? Pin
ZBUILDER14-Dec-02 19:35
ZBUILDER14-Dec-02 19:35 
AnswerRe: CSimpleArray ? Pin
Renjith Ramachandran14-Dec-02 20:13
Renjith Ramachandran14-Dec-02 20:13 
GeneralRe: CSimpleArray ? Pin
ZBUILDER14-Dec-02 20:18
ZBUILDER14-Dec-02 20:18 
GeneralRe: CSimpleArray ? Pin
Jörgen Sigvardsson15-Dec-02 4:28
Jörgen Sigvardsson15-Dec-02 4:28 
AnswerRe: CSimpleArray ? Pin
Jörgen Sigvardsson15-Dec-02 4:29
Jörgen Sigvardsson15-Dec-02 4:29 
GeneralHelp with context menu programming. Pin
trustno114-Dec-02 15:43
trustno114-Dec-02 15:43 
GeneralTemplate class question... Pin
Matt Gullett14-Dec-02 14:56
Matt Gullett14-Dec-02 14:56 
GeneralRe: Template class question... Pin
Taka Muraoka14-Dec-02 15:51
Taka Muraoka14-Dec-02 15:51 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 16:03
Matt Gullett14-Dec-02 16:03 
GeneralRe: Template class question... Pin
Taka Muraoka14-Dec-02 16:17
Taka Muraoka14-Dec-02 16:17 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 16:45
Matt Gullett14-Dec-02 16:45 
GeneralRe: Template class question... Pin
Taka Muraoka14-Dec-02 16:55
Taka Muraoka14-Dec-02 16:55 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 17:04
Matt Gullett14-Dec-02 17:04 
GeneralRe: Template class question... Pin
Todd Smith14-Dec-02 17:11
Todd Smith14-Dec-02 17:11 
GeneralRe: Template class question... Pin
Matt Gullett14-Dec-02 17:23
Matt Gullett14-Dec-02 17:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.