Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem regerding LineTo(..) Pin
summo6-May-03 3:21
summo6-May-03 3:21 
GeneralRe: Problem regerding LineTo(..) Pin
JensB6-May-03 4:42
JensB6-May-03 4:42 
GeneralRe: Problem regerding LineTo(..) Pin
John R. Shaw6-May-03 7:07
John R. Shaw6-May-03 7:07 
GeneralCFile %&% Pin
macmac386-May-03 2:50
macmac386-May-03 2:50 
GeneralRe: CFile %&% Pin
Mike Zinni6-May-03 3:15
Mike Zinni6-May-03 3:15 
GeneralRe: CFile %&% Pin
macmac386-May-03 3:24
macmac386-May-03 3:24 
GeneralRe: CFile %&% Pin
macmac386-May-03 3:54
macmac386-May-03 3:54 
GeneralRe: CFile %&% Pin
Mike Zinni6-May-03 4:10
Mike Zinni6-May-03 4:10 
Try:
CFileDialog dlg(FALSE);
CString fname = dlg.GetPathName(); 
char* szBuffer = NULL;
int i = 0;

CFile f;
if( f.Open ("F:\\test\\id.txt", CFile::modeRead ) )
{
  try {
    // Get the size of the file.
    i = f.GetLength();
    // Create buffer to hold file data.
    szBuffer = new char[i];
    // Read in the file data
    if(szBuffer != NULL)
      f.Read(szBuffer, i);
    // Close the file.
    f.Close();
  } catch (CFileException *e)
  {
    AfxMessageBox ("Error!");
    e->Delete();
  } // end TRY-CATCH
} // end IF

// If szBuffer != NULL, it contains the file data.
// Do whatever you want to it, and then make sure you 
// clean up the dynamic memory you new'ed.
if(szBuffer != NULL)
  delete [] szBuffer;


-Mike Zinni

"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
GeneralRe: CFile %&% Pin
macmac386-May-03 4:45
macmac386-May-03 4:45 
GeneralRe: CFile %&% Pin
David Crow6-May-03 4:49
David Crow6-May-03 4:49 
GeneralRe: CFile %&% Pin
macmac387-May-03 3:56
macmac387-May-03 3:56 
GeneralRe: CFile %&% Pin
David Crow6-May-03 4:20
David Crow6-May-03 4:20 
GeneralRe: CFile %&% Pin
Hans Ruck6-May-03 3:18
Hans Ruck6-May-03 3:18 
Generalstring substitution Pin
JensB6-May-03 2:49
JensB6-May-03 2:49 
GeneralRe: string substitution Pin
G. Steudtel6-May-03 4:02
G. Steudtel6-May-03 4:02 
QuestionHow to create a Virtual Serial Port with C++? Pin
d.schaeflein6-May-03 2:47
d.schaeflein6-May-03 2:47 
GeneralConvert "unsigned char[8]" to long Pin
Abebe6-May-03 2:42
Abebe6-May-03 2:42 
GeneralRe: Convert "unsigned char[8]" to long Pin
Xander806-May-03 2:52
Xander806-May-03 2:52 
GeneralRe: Convert "unsigned char[8]" to long Pin
Abebe8-May-03 4:55
Abebe8-May-03 4:55 
Generalshow web Page in a dialog box.. Pin
xxhimanshu6-May-03 2:39
xxhimanshu6-May-03 2:39 
GeneralRe: show web Page in a dialog box.. Pin
Joan M6-May-03 3:30
professionalJoan M6-May-03 3:30 
GeneralRe: show web Page in a dialog box.. Pin
Majid Shahabfar6-May-03 4:29
Majid Shahabfar6-May-03 4:29 
GeneralExtra Buttons on a SDI-Dialog Frame Pin
Harald Diel6-May-03 1:04
Harald Diel6-May-03 1:04 
GeneralRe: Extra Buttons on a SDI-Dialog Frame Pin
Neville Franks6-May-03 1:28
Neville Franks6-May-03 1:28 
GeneralRe: Extra Buttons on a SDI-Dialog Frame Pin
Roger Allen6-May-03 2:24
Roger Allen6-May-03 2:24 

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.