16,472
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
int main()
{
char sBuf[128] = " SysProperties.java c:\\SysProperties.java 0 ";
char s1[36],char s2[36],char s3[1];
sscanf(sBuf,"%s %s %s",s1,s2,s3);
printf("%s\n%s\n%s\n",s1,s2,s3);
return 0;
}
// test2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "string.h"
int main(int argc, char* argv[])
{
//printf("Hello World!\n");
char buf[ 1024 ] = " SysProperties.java c:\\SysProperties.java 0 ";
char tmp[ 3 ][ 100 ] = { "" };
char *p, *q;
p = strstr( buf, "Sys" );
q = strstr( p, " " );
memcpy( tmp[ 0 ], p, q - p );
p = strstr( p, "c:\\" );
q = strstr( p, " " );
memcpy( tmp[ 1 ], p, q - p );
p = strstr( p, "0" );
q = strstr( p, " " );
memcpy( tmp[ 2 ], p, q - p );
return 0;
}