char inter1[10000];
char inter2[10000];
case IDC_RADIO4:
memset(inter1,0,sizeof(inter1));
memset(inter2,0,sizeof(inter2));
memcpy(inter1,english1,sizeof(english1));
memcpy(inter2,chinese56,(sizeof(chinese56)+1)); itoa(strlen(inter2),str,10);
MessageBox(dhWnd,str,"ok",MB_OKCANCEL);
return 1;
case IDC_RADIO5:
memset(inter1,0,sizeof(inter1));
memset(inter2,0,sizeof(inter2)); memcpy(inter1,english2,sizeof(english2));
memcpy(inter2,chinese78,sizeof(chinese78));
itoa(strlen(inter2),str,10);
MessageBox(dhWnd,str,"ok",MB_OKCANCEL);
return 1;
case IDC_ENGLISH:
WriteFile(hInt,inter1,(sizeof(inter1)-1),&dwBytesWritten,NULL);
CloseHandle(hInt);
if(hInt==hCom) OpenCom();
else OpenLpt();
return 1;
case IDC_CHINESE:
for(i=0;i<4;i++)
WriteFile(hInt,inter2,(sizeof(inter2)-1),&dwBytesWritten,NULL);
CloseHandle(hInt);
if(hInt==hCom) OpenCom();
else OpenLpt();
return 1;打出来的是“烫”。
解决方案 »
- 哪里有管道通信的例程
- 仅仅只是一个Event
- 这个问题应该怎么解决?
- 客户端通过HTTP代理服务器连接到服务器端, 客户端是不是不能建立监听服务器发过来的消息?
- 求解决方法:Server端接到大量的数据后,然后要把这些数据发送大所有的Client( 250 个Client ),请问怎么解决?
- 解密高手请讲
- 今天在CSDN收到一个奇怪的、莫名奇妙的短消息。。。
- 各位高手,有谁写过nokia 升级软件的?如3310->3315,8210->8250,提供一点建议啊!来者有分,
- 怎样获得数据库记录总数?以及WM_COMMAND消息的问题??
- help me !数据库问题
- 请问图像的一个小问题(在线等)
- 急!请问多语种软件的开发有哪几种方法(除用语言DLL外)?
另外MessageBox(dhWnd,str,"ok",MB_OKCANCEL);里面的str的赋值代码呢
* set the first four bytes of buffer to "*".
*/#include <memory.h>
#include <stdio.h>void main( void )
{
char buffer[] = "This is a test of the memset function"; printf( "Before: %s\n", buffer );
memset( buffer, '*', 4 );
printf( "After: %s\n", buffer );
}
OutputBefore: This is a test of the memset function
After: **** is a test of the memset function
* handles it correctly; memcpy does not.
*/#include <memory.h>
#include <string.h>
#include <stdio.h>char string1[60] = "The quick brown dog jumps over the lazy fox";
char string2[60] = "The quick brown fox jumps over the lazy dog";
/* 1 2 3 4 5
* 12345678901234567890123456789012345678901234567890
*/void main( void )
{
printf( "Function:\tmemcpy without overlap\n" );
printf( "Source:\t\t%s\n", string1 + 40 );
printf( "Destination:\t%s\n", string1 + 16 );
memcpy( string1 + 16, string1 + 40, 3 );
printf( "Result:\t\t%s\n", string1 );
printf( "Length:\t\t%d characters\n\n", strlen( string1 ) ); /* Restore string1 to original contents */
memcpy( string1 + 16, string2 + 40, 3 ); printf( "Function:\tmemmove with overlap\n" );
printf( "Source:\t\t%s\n", string2 + 4 );
printf( "Destination:\t%s\n", string2 + 10 );
memmove( string2 + 10, string2 + 4, 40 );
printf( "Result:\t\t%s\n", string2 );
printf( "Length:\t\t%d characters\n\n", strlen( string2 ) ); printf( "Function:\tmemcpy with overlap\n" );
printf( "Source:\t\t%s\n", string1 + 4 );
printf( "Destination:\t%s\n", string1 + 10 );
memcpy( string1 + 10, string1 + 4, 40 );
printf( "Result:\t\t%s\n", string1 );
printf( "Length:\t\t%d characters\n\n", strlen( string1 ) );
}
OutputFunction: memcpy without overlap
Source: fox
Destination: dog jumps over the lazy fox
Result: The quick brown fox jumps over the lazy fox
Length: 43 charactersFunction: memmove with overlap
Source: quick brown fox jumps over the lazy dog
Destination: brown fox jumps over the lazy dog
Result: The quick quick brown fox jumps over the lazy dog
Length: 49 charactersFunction: memcpy with overlap
Source: quick brown dog jumps over the lazy fox
Destination: brown dog jumps over the lazy fox
Result: The quick quick brown dog jumps over the lazy fox
Length: 49 characters
itoa(strlen(inter1),str,10);
MessageBox(dhWnd,str,"ok",MB_OKCANCEL);
char inter1[10000];
char inter2[10000];
在分支
case IDC_RADIO4:
case IDC_RADIO5:
中赋值,而在
case IDC_ENGLISH:
case IDC_CHINESE:
分支中使用。
这些分支之间无必然的调用顺序关系。