ぼるじょあがC/C++の宿題を片付けますYO! 35代目
■ このスレッドは過去ログ倉庫に格納されています
0237233
NGNG>>232まぁとりあえず書いた。環境は知らんから cc で確認
#include <stdio.h>
#include <stdlib.h>
#define BUFFER_SIZE 256
int main( int argc, char *argv[] ){
FILE *fp = NULL;
char buf[ BUFFER_SIZE ] = { '\0' };
if( ( fp = tmpfile() ) == NULL ){
printf( "file was not created.\n" );
return EXIT_FAILURE;
}
printf( "input strings[EOF:stop]\n" );
while( scanf( "%s", buf ) != EOF )
fwrite( buf, sizeof( char ), BUFFER_SIZE, fp );
fseek( fp, 0, SEEK_SET );
printf( "\ninputed string are...\n" );
for( ;; ){
fread( buf, sizeof( char ), BUFFER_SIZE, fp );
if( feof( fp ) )
break;
printf( "%s\n", buf );
}
fclose( fp );
return EXIT_SUCCESS;
}
■ このスレッドは過去ログ倉庫に格納されています