c语言不是很会,但是要用到这次,请教fprintf()方法的参数的意义,以及怎样向文件输出无符号长整型用那个格式符
c语言不是很会,但是要用到这次,请问fprintf()方法的参数的意义,以及怎样向文件输出无符号长整型用那个格式符
如题,谢谢!
------解决方案--------------------
格式化输出到一个流,比如文件流
// crt_fprintf.c
/* This program uses fprintf to format various
* data and print it to the file named FPRINTF.OUT. It
* then displays FPRINTF.OUT on the screen using the system
* function to invoke the operating-system TYPE command.
*/
#include <stdio.h>
#include <process.h>
FILE *stream;
int main( void )
{
int i = 10;
double fp = 1.5;
char s[] = "this is a string ";
char c = '\n ';
fopen_s( &stream, "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 " );
}
------解决方案--------------------
%lu
如题,谢谢!
------解决方案--------------------
格式化输出到一个流,比如文件流
// crt_fprintf.c
/* This program uses fprintf to format various
* data and print it to the file named FPRINTF.OUT. It
* then displays FPRINTF.OUT on the screen using the system
* function to invoke the operating-system TYPE command.
*/
#include <stdio.h>
#include <process.h>
FILE *stream;
int main( void )
{
int i = 10;
double fp = 1.5;
char s[] = "this is a string ";
char c = '\n ';
fopen_s( &stream, "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 " );
}
------解决方案--------------------
%lu