Click here to Skip to main content
15,867,308 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problems with project from VS2003 in VS2005 Pin
James R. Twine1-Mar-07 6:24
James R. Twine1-Mar-07 6:24 
GeneralRe: Problems with project from VS2003 in VS2005 Pin
Asdef Jaker1-Mar-07 6:47
Asdef Jaker1-Mar-07 6:47 
GeneralRe: Problems with project from VS2003 in VS2005 Pin
James R. Twine1-Mar-07 7:05
James R. Twine1-Mar-07 7:05 
QuestionRe: Problems with project from VS2003 in VS2005 Pin
Asdef Jaker1-Mar-07 7:19
Asdef Jaker1-Mar-07 7:19 
AnswerRe: Problems with project from VS2003 in VS2005 Pin
James R. Twine1-Mar-07 8:46
James R. Twine1-Mar-07 8:46 
Questionstd::string Pin
LCI1-Mar-07 3:20
LCI1-Mar-07 3:20 
AnswerRe: std::string Pin
toxcct1-Mar-07 3:27
toxcct1-Mar-07 3:27 
GeneralRe: std::string Pin
LCI1-Mar-07 3:34
LCI1-Mar-07 3:34 
How would i get around this??
Myabe use a TCHAR or LPVOID in the ReadFile and then once i get the value, convert that to an std::string??
How would that work?
The definition of ReadFile is
BOOL ReadFile(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
);

Parameters
hFile
[in] Handle to the file to be read. The file handle must have been created with the GENERIC_READ access right. For more information, see File Security and Access Rights.
For asynchronous read operations, hFile can be any handle opened with the FILE_FLAG_OVERLAPPED flag by the CreateFile function, or a socket handle returned by the socket or accept function.


Windows Me/98/95: For asynchronous read operations, hFile can be a communications resource opened with the FILE_FLAG_OVERLAPPED flag by CreateFile, or a socket handle returned by socket or accept. You cannot perform asynchronous read operations on mailslots, named pipes, or disk files.



lpBuffer
[out] Pointer to the buffer that receives the data read from the file.
nNumberOfBytesToRead
[in] Number of bytes to be read from the file.
lpNumberOfBytesRead
[out] Pointer to the variable that receives the number of bytes read. ReadFile sets this value to zero before doing any work or error checking. If this parameter is zero when ReadFile returns TRUE on a named pipe, the other end of the message-mode pipe called the WriteFile function with nNumberOfBytesToWrite set to zero.
If lpOverlapped is NULL, lpNumberOfBytesRead cannot be NULL. If lpOverlapped is not NULL, lpNumberOfBytesRead can be NULL. If this is an overlapped read operation, you can get the number of bytes read by calling GetOverlappedResult. If hFile is associated with an I/O completion port, you can get the number of bytes read by calling GetQueuedCompletionStatus.

If I/O completion ports are used and you are using a callback routine to free the memory allocated to the OVERLAPPED structure pointed to by the lpOverlapped parameter, specify NULL as the value of this parameter to avoid a memory corruption problem during the deallocation. This memory corruption problem will cause an invalid number of bytes to be returned in this parameter.


Windows Me/98/95: This parameter cannot be NULL.


lpOverlapped
[in] Pointer to an OVERLAPPED structure. This structure is required if hFile was created with FILE_FLAG_OVERLAPPED.
If hFile was opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must not be NULL. It must point to a valid OVERLAPPED structure. If hFile was created with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function can incorrectly report that the read operation is complete.

If hFile was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the read operation starts at the offset specified in the OVERLAPPED structure and ReadFile may return before the read operation has been completed. In this case, ReadFile returns FALSE and the GetLastError function returns ERROR_IO_PENDING. This allows the calling process to continue while the read operation finishes. The event specified in the OVERLAPPED structure is set to the signaled state upon completion of the read operation.

If hFile was not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the read operation starts at the current file position and ReadFile does not return until the operation has been completed.

If hFile is not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the read operation starts at the offset specified in the OVERLAPPED structure. ReadFile does not return until the read operation has been completed.


Windows 95/98/Me: For operations on files, disks, pipes, or mailslots, this parameter must be NULL; a pointer to an OVERLAPPED structure causes the call to fail. However, you can perform overlapped I/O on serial and parallel ports.

GeneralRe: std::string Pin
toxcct1-Mar-07 3:36
toxcct1-Mar-07 3:36 
GeneralRe: std::string Pin
David Crow1-Mar-07 3:39
David Crow1-Mar-07 3:39 
GeneralRe: std::string Pin
LCI1-Mar-07 3:42
LCI1-Mar-07 3:42 
GeneralRe: std::string Pin
David Crow1-Mar-07 3:51
David Crow1-Mar-07 3:51 
JokeRe: std::string Pin
toxcct1-Mar-07 3:58
toxcct1-Mar-07 3:58 
GeneralRe: std::string [updated] Pin
James R. Twine1-Mar-07 6:18
James R. Twine1-Mar-07 6:18 
GeneralRe: std::string Pin
David Crow1-Mar-07 8:17
David Crow1-Mar-07 8:17 
GeneralRe: std::string Pin
Nemanja Trifunovic1-Mar-07 8:45
Nemanja Trifunovic1-Mar-07 8:45 
GeneralRe: std::string Pin
LCI1-Mar-07 3:36
LCI1-Mar-07 3:36 
GeneralRe: std::string Pin
David Crow1-Mar-07 3:37
David Crow1-Mar-07 3:37 
GeneralRe: std::string Pin
LCI1-Mar-07 3:39
LCI1-Mar-07 3:39 
GeneralRe: std::string Pin
toxcct1-Mar-07 3:41
toxcct1-Mar-07 3:41 
GeneralRe: std::string Pin
toxcct1-Mar-07 3:41
toxcct1-Mar-07 3:41 
AnswerRe: std::string Pin
KaЯl1-Mar-07 3:33
KaЯl1-Mar-07 3:33 
GeneralRe: std::string Pin
LCI1-Mar-07 3:35
LCI1-Mar-07 3:35 
QuestionCreating Process Pin
Programm3r1-Mar-07 2:32
Programm3r1-Mar-07 2:32 
AnswerRe: Creating Process Pin
toxcct1-Mar-07 3:10
toxcct1-Mar-07 3:10 

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.