char str[5]; char buf[6]="12345"; sscanf(buf,"%s",str);//此处buf是数组名,它的意思是将12345以%s的形式存入str中! cout<<str<<endl;