fprintf的用法

来源:互联网 发布:淘宝国外代购是真的吗 编辑:程序博客网 时间:2024/06/08 11:15

fprintf 是对于文件的操作

#include <stdio.h> #include <process.h> FILE *stream; void main( void ) { int i = 10; double fp = 1.5; char s[] = "this is a string"; char c = '/n'; stream = fopen( "fprintf.out", "w" ); fprintf( stream, "%s%c", s, c ); fprintf( stream, "%d/n", i ); fprintf( stream, "%f/n", fp ); fclose( stream ); system( "type fprintf.out" ); //---------> system函數:功能:發出一個DOS命令} 

屏幕输出:

this is a string
10
1.500000


 

原创粉丝点击