Home > Software engineering >  Consult the MFC C cstrings conversion issues
Consult the MFC C cstrings conversion issues

Time:09-19

Request from returns a cstrings EditControl edit box type variable, to be written to the memory mapping file, and then read it shows


Younger brother all sorts of methods are tried, read digital type string won't be a problem, but want to read, for example "adasda" this is written to the file mapping '0'

CodePudding user response:


Notice the string type and compiled using cstrings set about: would be * (set to UNICODE), or for the char *

CodePudding user response:

HMMF is an address pointer, it points to a memory block
Accurate method should be used memcpy copy in the past, if you want to save memory replication, then directly using hMMF memory
 
Int len=GetDlgItem (1) - & gt; GetWindowTextLength ();
If (len & gt; 0)
{
LPTSTR pszBuffer=(LPTSTR hMMF);
GetDlgItem (1) - & gt; GetWindowText (pszBuffer, len + 1);
}


First you have to promise to less than hMMF len pointed to the size of the memory

CodePudding user response:

Strcpy_s (hMMF (char *), 10, "123");
  • Related