F
flai
Unregistered / Unconfirmed
GUEST, unregistred user!
#include "stdio.h"
#include "tchar.h"
#include "time.h"
#include "stdlib.h"
void main()
{
struct st_test
{
char a[4];
char b[5];
} test;
char str[1024];
strcpy(str,"102412345");
memmove(&test,str,strlen(str));
printf("len=%d,test.a=%s/n",strlen(test.a),test.a);
printf("len=%d,test.b=%s/n",strlen(test.b),test.b);
getchar();
}
这样写,不能得到正确结果,错在哪?如何写才对?谢谢!
#include "tchar.h"
#include "time.h"
#include "stdlib.h"
void main()
{
struct st_test
{
char a[4];
char b[5];
} test;
char str[1024];
strcpy(str,"102412345");
memmove(&test,str,strlen(str));
printf("len=%d,test.a=%s/n",strlen(test.a),test.a);
printf("len=%d,test.b=%s/n",strlen(test.b),test.b);
getchar();
}
这样写,不能得到正确结果,错在哪?如何写才对?谢谢!