Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: [Message Deleted] Pin
Hamid_RT10-Feb-08 21:42
Hamid_RT10-Feb-08 21:42 
AnswerRe: [Message Deleted] Pin
ashwiny10-Feb-08 22:25
ashwiny10-Feb-08 22:25 
GeneralRe: [Message Deleted] Pin
Hamid_RT11-Feb-08 3:38
Hamid_RT11-Feb-08 3:38 
GeneralProblem in opening a file. Pin
Sanjay K7-Feb-08 6:14
Sanjay K7-Feb-08 6:14 
GeneralRe: Problem in opening a file. Pin
Mark Salsbery7-Feb-08 6:38
Mark Salsbery7-Feb-08 6:38 
GeneralRe: Problem in opening a file. Pin
Member 434202611-Feb-08 2:41
Member 434202611-Feb-08 2:41 
GeneralRe: Problem in opening a file. Pin
Sanjay K12-Feb-08 0:41
Sanjay K12-Feb-08 0:41 
GeneralERROR_PATH_NOT_FOUND error Pin
Larry Mills Sr7-Feb-08 5:22
Larry Mills Sr7-Feb-08 5:22 
Does anyone know why I get this error when I copied the code directly from MSDN:

TCHAR* pstrName = _T("C:\\test\\SetPath_File.dat");

// open a file
HANDLE hFile = ::CreateFile(pstrName, GENERIC_WRITE, FILE_SHARE_READ,
NULL, CREATE_ALWAYS, 0, NULL);
//=================================== get ERROR_PATH_NOT_FOUND error here!
if (hFile != INVALID_HANDLE_VALUE)
{
// attach a CFile object to it
CFile myFile(hFile);

// At this point, myFile doesn't know the path name for the file
// it owns because Windows doesn't associate that information
// with the handle. Any CFileExceptions thrown by this object
// won't have complete information.

// Calling SetFilePath() remedies that problem by letting CFile
// know the name of the file that's associated with the object.

myFile.SetFilePath(pstrName);

// write something to the file and flush it immediately
DWORD dwValue = 1234;
myFile.Write(&dwValue, sizeof(dwValue));
myFile.Flush();

// destroying the CObject here will call ::CloseHandle() on the file
}

A C++ programming language novice, but striving to learn
QuestionRe: ERROR_PATH_NOT_FOUND error Pin
Mark Salsbery7-Feb-08 5:49
Mark Salsbery7-Feb-08 5:49 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
led mike7-Feb-08 6:43
led mike7-Feb-08 6:43 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Mark Salsbery7-Feb-08 6:58
Mark Salsbery7-Feb-08 6:58 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Larry Mills Sr7-Feb-08 7:31
Larry Mills Sr7-Feb-08 7:31 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Mark Salsbery7-Feb-08 7:34
Mark Salsbery7-Feb-08 7:34 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
led mike7-Feb-08 8:12
led mike7-Feb-08 8:12 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Mark Salsbery7-Feb-08 8:51
Mark Salsbery7-Feb-08 8:51 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
led mike7-Feb-08 9:40
led mike7-Feb-08 9:40 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Larry Mills Sr10-Feb-08 11:16
Larry Mills Sr10-Feb-08 11:16 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Mark Salsbery7-Feb-08 7:40
Mark Salsbery7-Feb-08 7:40 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Larry Mills Sr7-Feb-08 10:45
Larry Mills Sr7-Feb-08 10:45 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Mark Salsbery8-Feb-08 6:38
Mark Salsbery8-Feb-08 6:38 
GeneralRe: ERROR_PATH_NOT_FOUND error Pin
Stephen Hewitt7-Feb-08 12:34
Stephen Hewitt7-Feb-08 12:34 
QuestionPrinting to a printer onto a form Pin
Henri7-Feb-08 3:07
Henri7-Feb-08 3:07 
GeneralRe: Printing to a printer onto a form Pin
Matthew Faithfull7-Feb-08 3:26
Matthew Faithfull7-Feb-08 3:26 
GeneralRe: Printing to a printer onto a form Pin
Mark Salsbery7-Feb-08 5:54
Mark Salsbery7-Feb-08 5:54 
QuestionRe: Printing to a printer onto a form Pin
Henri7-Feb-08 8:17
Henri7-Feb-08 8:17 

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.