编译环境:VC在网络通信中,两个网络需要传输文件,怎么样才能控制我只能传输文本文件?还有,我能否对文本文件的内容进行控制,具体的又怎么控制呢?请高手帮帮忙哦,先谢了.

解决方案 »

  1.   

    read through the file, check the existence of non printable char, if not exist, you can suppose this file is a text file.
      

  2.   

    check the existence of non printable char怎么判断?
      

  3.   

    isprint, iswprint
    int isprint( int c );int iswprint( wint_t c );Each of these routines returns true if c is a particular representation of a printable character.
      

  4.   

    可以读它的文件头,不同的文件的文件头部不同,可以读进来判断一下
    如果一个文本是Unicode的,采用如上办法估计……