fprintf是用于文件操作的,原型是int fprintf( FILE *stream, const char *format [, argument ]...);
舉例用法: #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" ); } 屏幕輸出: this is a string 10 1.500000 printf就是在屏幕打印出一段字符串來啊 原型是int printf( const char *format [, argument]... ); 是標準輸出,。 |
|