如果添加新关系,我需要退出此循环! 只要它是空的或按下“回车”,它就需要继续运行。
var startInfo = new ProcessStartInfo("myprogram.exe");
startInfo.Arguments = "do_admin_stuff";
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
Process.Start(startInfo);
输出:
CODE:
static char input[100];
int main()
{
printf("Press Ctrl+c to Exit!\n");
while(1)
{
//Input (stdin) and output (stdout) declared in <stdio.h> library
fputs("esp>", stdout);
fgets(input,100,stdin);
if(input != 0) //here I can not change it !!!
return 1;
}
return 0;
}
答案 0 :(得分:2)
如果你只想检查空输入,试试这个吗?
while(1)
{
fputs("esp> ", stdout );
fgets( input, 100, stdin );
if( input[0] != '\n' && strlen(input) )
{
// Do something with input
}
}