NVS

char * pszStr = new char[30]; USHORT usLen = 5; std::string strName = "hello"; USHORT usPassLen = 5; std::string strPass = "12345"; _snprintf(pszStr,14,"%3c%s%3c%s",usLen,strName.c_str(),usPassLen,strPass.c_str()); FILE * file1 = NULL; file1 = fopen("c://a.txt","wb"); fwrite(pszStr,sizeof(char),15,file1); fclose(file1); for (int i = 0;i <= 15; i++) { printf("%x ",*(pszStr+i)); } //printf("%s",pszStr); char *p = (char *)&usLen; printf("%x ",*p); printf("%x ",*(p+1)); return 0;

你可能感兴趣的:(NVS)