Mercurial > hg > Gears > Gears
changeset 969:5573463fe469
add buffer with Array
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Apr 2021 17:50:24 +0900 |
parents | d082c861d5c2 |
children | 89ea952f0f2b |
files | src/parallel_execution/examples/wc/WcImpl.cbc |
diffstat | 1 files changed, 11 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/examples/wc/WcImpl.cbc Thu Apr 08 20:52:08 2021 +0900 +++ b/src/parallel_execution/examples/wc/WcImpl.cbc Tue Apr 13 17:50:24 2021 +0900 @@ -42,21 +42,22 @@ Count char TODO */ - - static char stdinBuf[BUFSIZ]; - static char stdoutBuf[BUFSIZ]; + int buf_size = 10000; int LINE_SIZE = 1024; char line[LINE_SIZE]; - - if( setvbuf( wc->file, stdinBuf, BUFFERING_MODE, sizeof(stdinBuf)) != 0 ){ + /* + if( setvbuf( wc->file, buffer, BUFFERING_MODE, sizeof(buffer)) != 0 ){ fputs("stdinのバッファリングを変更できませんでした。", stderr); exit(EXIT_FAILURE); } else { - printf("setvbuffer"); + printf("setvbuffer\n"); } - while(fgets(line, LINE_SIZE, wc->file)!=NULL){ - printf("%s", line); - } - + */ + char buffer[buf_size]; + int m = fread(buffer, sizeof( char ), buf_size ,wc->file); + int i = 0; + printf("文字数=%d\n", m); + printf("%s\n" ,buffer); + //goto countUp(wc, next); }