小兵的专栏

海阔凭鱼跃,天高任鸟飞

用户操作
[即时聊天] [发私信] [加为好友]
王兵ID:flyingstarwb
14481次访问,排名8074(-1)好友1人,关注者3
四川大学在读研究生 网络安全专业,项目经验丰富,有团队精神,善于与人交往。
flyingstarwb的文章
原创 69 篇
翻译 0 篇
转载 4 篇
评论 6 篇
最近评论
bluehouse1985:Linux 环境下的多核调试
— Intel + Totalview 强强联合!
目前,在软件开发行业,各种性能优异的调试工具层出不穷。但是,它们中的绝大部分都只支持windows环境。即使能支持linux平台,操作起来也很不方便。因此,对于长期在linux上编写程序的开发人员来说,如何调试就成了一个令人头痛的问题!Intel软件 和 Total……
bluehouse1985:Linux 环境下的多核调试
— Intel + Totalview 强强联合!
目前,在软件开发行业,各种性能优异的调试工具层出不穷。但是,它们中的绝大部分都只支持windows环境。即使能支持linux平台,操作起来也很不方便。因此,对于长期在linux上编写程序的开发人员来说,如何调试就成了一个令人头痛的问题!Intel软件 和 Total……
flyingstarwb:格式已经修改了,谢谢批评!
Maokun:你好,我是格初学者,今天研究openFileDialog的使用,老是保异常,用了你的代码,还报异常。
当单击按钮打开openFileDialog时,在不关闭的同时,再次单击按钮打开它,就报异常;
suki_java:格式有点糟糕,但是我很想看,没办法凑合了!o(∩_∩)o...
文章分类
收藏
    相册
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 /dev/null 于 /dev/zero文件收藏

    新一篇: valgrind 介绍 | 旧一篇: 【转载】fatal error C1010: unexpected end of file while looking for precompiled header directive

    在目录/dev下有两个特殊的设备文件:/dev/null和/dev/zero。它们并不是真实的设备文件,那它们是什么?它们有什么区别?我在自己的blog上做个记录。

    下面关于它们的内容来自于维基百科。

    关于/dev/null:

    In Unix-like operating systems, /dev/null or the null device is a special file that discards all data written to it, and provides no data to any process that reads from it (it returns EOF). In Unix programmer jargon, it may also be called the bit bucket or black hole.

    The null device is typically used for disposing of unwanted output streams of a process, or as a convenient empty file for input streams. This is usually done by redirection.

    This entity is a common inspiration for technical jargon expressions and metaphors by Unix programmers, e.g. "please send complaints to /dev/null" or "my mail got archived in /dev/null", being jocular ways of saying, respectively: "don't bother to send any complaints" and "my mail got deleted". A famous advertisement for the Titanium PowerBook G4 read [The Titanium Powerbook G4] Sends other UNIX boxes to /dev/null.

    The null device is also a favorite subject of technical jokes, such as warning users that the system's /dev/null is already 98% full. The April Fool's, 1995 issue of the German magazine c't reported on an enhanced /dev/null chip that would efficiently dispose of the incoming data by converting it to flicker on an internal glowing LED.

    /dev/null is a special file, not a directory (folder), so one cannot move files into it with the Unix mv command. See rm for the proper way to delete files in Unix.

    The equivalent device in CP/M (and later DOS and Windows) is called NUL:, and on some versions of DOS just NUL (for example, one may hide output by directing it to NUL, e.g. PAUSE>NUL, which waits for the user to press any key without printing anything to the screen). Under classic Amiga operating systems, the device's name is NIL:. In Windows NT and its successors, it is named \Device\Null internally, though, the DOS NUL is a symbolic link to it. Similarly, in OpenVMS the device is named NL:.


    关于/dev/zero:

    In Unix-like operating systems, /dev/zero is a special file that provides as many null characters (ASCII NULL, 0x00; not ASCII character "digit zero", "0", 0x30) as are read from it. One of the typical uses is to provide a character stream for overwriting information. Another might be to generate a clean file of a certain size. Using mmap to map /dev/zero to RAM is the BSD way of implementing shared memory.

    # Initialise partition (important note: trying out this command will eradicate 
    # any files that were on the partition, make sure you have a backup of any important data.)
    dd if=/dev/zero of=/dev/hda7
    # Create a large empty file called 'foobar'
    dd if=/dev/zero of=foobar count=1000 bs=1000

    Like /dev/null, /dev/zero acts as a source and sink for data. All writes to /dev/zero succeed with no other effects (the same as for /dev/null, although /dev/null is the more commonly used data sink); all reads on /dev/zero return as many NULs as characters requested.

    (转)http://www.rainway.org/index.php/2004/10/28/unix-stdout/
     

    细细品味UNIX的数据流重定向

      我们经常会在UNIX系统下的一些脚本中看到类似”2>&1″这样的用法,例如“/path/to/prog 2>&1 > /dev/null &”,那么它的具体含义是什么呢?
      UNIX有几种输入输出流,它们分别与几个数字有如下的对应关系:0-标准输入流(stdin),1-标准输出流(stdout),2-标准错误流(stderr)。”2>&1″的意思就是将stderr重定向至stdout,并一起在屏幕上显示出来。如果不加数字,那么默认的重定向动作是针对stdout(1)的,比如”ls -l > result”就等价于”ls -l 1 > result”。这样便于我们更普遍性的理解重定向过程。
      下面举例说明:
    #cat std.sh
    #!/bin/sh
    echo “stdout”
    echo “stderr” >&2

    #/bin/sh std.sh 2>&1 > /dev/null
    stderr

    #/bin/sh std.sh > /dev/null 2>&1

      第一条命令的输出结果是stderr,因为stdout和stderr合并后一同重定向到/dev/null,但stderr并未被清除,因此仍将在屏幕中显示出来;第二条命令无输出,因为当stdout重定向至/dev/null后,stderr又重定向到了stdout,这样stderr也被输出到了/dev/null。

     

     

    发表于 @ 2007年12月03日 20:33:00|评论(loading...)|编辑

    新一篇: valgrind 介绍 | 旧一篇: 【转载】fatal error C1010: unexpected end of file while looking for precompiled header directive

    评论:没有评论。

    发表评论  


    登录
    Csdn Blog version 3.1a
    Copyright © 小兵