C/C++ 文件操作大概有以下几种1.C的文件操作;2.C++的文件操作;3.WINAPI的文件操作;4.BCB库的文件操作;5.特殊文件的操作。当然了,水题时最常用的当然还是:freopen("stdin.txt","r",stdin);freopen("stdout.txt","w",stdou...
分类:
编程语言 时间:
2015-07-24 20:08:42
阅读次数:
192
go的匿名函数: func no_func() { // 匿名函数 1 f := func(i, j int) (result int) { // f 为函数地址 result = i + j return result } fmt.Fprintf(os.Stdout, "f = %v ?f(1,3) = %v\n", f, f(1, 3)) // 匿名函...
分类:
其他好文 时间:
2015-07-20 14:36:57
阅读次数:
141
dup和dup2也是两个非常有用的调用,它们的作用都是用来复制一个文件的描述符。它们经常用来重定向进程的stdin、stdout和stderr。这两个函数的原形如下:#include int dup( int oldfd ); int dup2( int oldfd, int targetfd...
分类:
其他好文 时间:
2015-07-17 00:07:16
阅读次数:
213
#!/usr/bin/envpython
importsubprocess
try:
importsimplejsonasjson
except:
importjson
memory_status={}
p=subprocess.Popen("dmidecode--typesystem|perl-alne‘/Manufacturer:\s(.*)/andprint$1‘",shell=True,stdout=subprocess.PIPE)
vender=p.stdout.readline().s..
分类:
编程语言 时间:
2015-07-16 22:38:55
阅读次数:
253
今天写一个小脚本的时候,需要即时输出当前进度到命令行上,并即时将重要数据写入报告文件中。但是perl默认是有输出缓冲的,显示到命令行上必须以\n结尾才行,输出到文件中,回车了都不行,非得要等缓冲区满了。 代码: select( STDOUT ); $| = 1; open( REPORT, ">re...
分类:
其他好文 时间:
2015-07-16 18:36:49
阅读次数:
113
php:// — 访问各个输入/输出流(I/O streams)说明PHP 提供了一些杂项输入/输出(IO)流,允许访问 PHP 的输入输出流、标准输入输出和错误描述符, 内存中、磁盘备份的临时文件流以及可以操作其他读取写入文件资源的过滤器。php://stdin, php://stdout 和 p...
分类:
Web程序 时间:
2015-07-14 17:23:55
阅读次数:
149
1、当我们想要查看应用程序当前目录时,可以使用cwd函数 process.cwd(); 2、将内容打印到输出设备上 process.stdout.write(‘hello?world‘); 3、stderr是标准错误流 process.stderr.write(‘hello?world‘); 4、设...
分类:
Web程序 时间:
2015-07-13 14:19:31
阅读次数:
132
https://leetcode.com/problems/valid-phone-numbers/
# Read from the file file.txt and output all valid phone numbers to stdout.
awk '/^([0-9]{3}-|\([0-9]{3}\) )[0-9]{3}-[0-9]{4}$/{print $0}' fi...
分类:
其他好文 时间:
2015-07-11 15:13:34
阅读次数:
123
在此之前先区分一下:printf,sprintf,fprintf。
1、printf就是标准输出,在屏幕上打印出一段字符串来。
#include
原型:void printf(const char
*format,[argument]);
功能:一般用于向标准输出设备按规定格式输出信息。
2、sprintf就是把格式化的数据写入到某个字符串中。返回值字符串的长...
分类:
其他好文 时间:
2015-07-10 11:21:17
阅读次数:
143
>>> import sys>>> sys.stdout.write('Hello World!\n')Hello World!13>>> sys.platform'win32'>>> sys.version'3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:4...
分类:
其他好文 时间:
2015-07-09 12:54:22
阅读次数:
537