C&&C++ 简单 文件处理

来源:互联网 发布:淘宝logo头像免费制作 编辑:程序博客网 时间:2024/06/03 21:20

 

写一小段C&&C++文件输入输出,之前不太了解 ,请各位大牛指导。

VERSION C:

其中fscanf 的参数 :

'%d' : Scan an integer as a signed decimal number.

'%i' : Scan an integer as a signed number.

'%u' : Scan for decimal unsigned int, unsigned short, and unsigned char

'%f' : Scan a floating-point number in normal (fixed-point) notation.  

'%g', '%G' : Scan a floating-point number in either normal or exponential notation.

'%x', '%X' : Scan an integer as an unsigned hexadecimal number.  

'%o' : Scan an integer as an octal number.  

'%s' : Scan a character string. The scan terminates at whitespace.   

'%c' : Scan a character (char). No null character is added.'(space)': Space scans for whitespace characters.  

'%lf' : Scan as a double floating-point number.  

'%Lf' : Scan as a long double floating-point number.

 

出自:百度百科

 

C++ VERSION:

最奇怪的就是注释里面的  函数的参数加上& 程序才能正确运行 反之 则不能。

部分内容参考自:C++ 

更多操作也在里面。

 

 

本次是为了总结一下常用的文件读取操作。

PS:感谢C++版的各位大牛,流对象不能复制和赋值,所以一定要使用&,感谢给位。2011-03-28 10:13:44

 

 


写于  2011-03-25 17:09:53

 



原创粉丝点击