c++如何判断输入流为空?

来源:百度知道 编辑:UC知道 时间:2024/06/24 22:20:44
请问有什么语句或函数可以判断输入为空?

……
char ss;
scanf("%s",&ss);
if(ss=='/0')
printf("ss为空");
……

' ' == c;

#include <stdio.h>
#include <ctype.h>
void main()
{
char str=' ';
printf("输入字符串:");
;
if((str=getchar())=='\n')
printf("字符为空\n");
else printf("字符不为空\n");

}