#includeint main (){ #ifdef ONLINE_JUDGE #else freopen ("in.txt","r",stdin); #endif int n,m; int a[101]; while(scanf("%d",&n)!=EOF&&(na[k+1])...
分类:
其他好文 时间:
2014-11-23 22:52:28
阅读次数:
245
使用C语言处理行输入的时候,使用fgets()。现在我要在某行输入“ENDOFINPUT”的时候,终止处理。所以果断就写了以下:char buf[256];fgets(buf, 256, stdin);while ( strcmp(buf, "ENDOFINPUT") != 0) { ... }按理...
分类:
其他好文 时间:
2014-11-22 22:58:55
阅读次数:
388
sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行为单位进行处理,可以将数据行进行替换、删除、新增、选取等特定工作,下面先了解一下sed的用法
sed命令行格式为:
sed [-nefri] ‘command’ 输入文本
常用选项:
-n∶使用安静(silent)模式。在一般 sed 的用法中,所有来自 STDIN的资料一般...
分类:
系统相关 时间:
2014-11-21 18:47:14
阅读次数:
259
int main(){ freopen("in1.txt","r",stdin); freopen("out.txt","w",stdout); int i=0,j=0; int temp=0, a[200],b[200],f[400]; char s[200]; scanf("%s",s)...
分类:
其他好文 时间:
2014-11-21 15:44:17
阅读次数:
277
如果在windows后台跑python,可以通过添加windows自定义服务,或者改后缀将脚本修改为pyw,这样就不会弹出控制窗口,但是标准输出和标准错误输出就没用了。。。。。stdin也无效。windows的创建自定义服务,参见链接http://support.microsoft.com/kb/137890
分类:
其他好文 时间:
2014-11-21 00:03:21
阅读次数:
293
dup和dup2也是两个非常有用的调用,它们的作用都是用来复制一个文件的描述符。它们经常用来重定向进程的stdin、stdout和stderr。这两个函数的原形如下:
#include
int dup( int oldfd );
int dup2( int oldfd, int targetfd );
dup()函数:
利用函数dup,我们可以复制一个描述符。传给该函数一个既有的描述符...
分类:
其他好文 时间:
2014-11-17 21:23:54
阅读次数:
160
使用 Lua 中的table.getn获得数组的table的长度;运行失败--> t ={1,2,3 }> print(table.getn(t))stdin:1: attempt to call field 'getn' (a nil value)stack traceback: stdin:1:...
分类:
其他好文 时间:
2014-11-14 13:55:41
阅读次数:
167
#!/bin/bashforiin`seq13`douseradduserl-$iecho"0"|passwduserl-$i--stdin批量添加密码done[root@localhost~]#sh-xcreate_user.sh++seq13+foriin‘`seq13`‘+useradduserl-1+echo0+passwduserl-1--stdinChangingpasswordforusercoral-1.passwd:allauthenticationtokensupdatedsu..
分类:
其他好文 时间:
2014-11-12 12:01:14
阅读次数:
194
若需要将输出同时发送到监视器和日志文件中,可以使用命令tee即可tee命令就像管道的T型接头,可以将STDIN的数据同时发送到两个目的地!一个是STDOUT,另外一个是tee命令行指定的文件名:[root@localhost~]#date|teeabc.txt2014年11月10日星期一14:44:37CSTSTDOUT[root@localhos..
分类:
其他好文 时间:
2014-11-10 15:39:35
阅读次数:
174
1. 重定向
执行一个命令,有输入,有输出。
标准输入: standard input ,检查 stdin , 代码为0, 使用< 或 < 或 >>
标准错误输出; standard error output. 简称:stderr, 命令执行返回的错误信息。 代码为2, 使用 > 或 >>
默认都输出到屏幕上。...
分类:
系统相关 时间:
2014-11-10 10:06:46
阅读次数:
271