changeset 965:d00ec1274f23

add fgets
author ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
date Tue, 30 Mar 2021 17:54:46 +0900
parents c5c3e9f1533a
children 9efaa40e56fa
files src/parallel_execution/examples/wc/WcImpl.cbc
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/examples/wc/WcImpl.cbc	Thu Mar 18 10:49:58 2021 +0900
+++ b/src/parallel_execution/examples/wc/WcImpl.cbc	Tue Mar 30 17:54:46 2021 +0900
@@ -3,13 +3,6 @@
 #impl "Wc.h" as "WcImpl.h"
 #interface "WcResult.h"
 
-// ----
-// typedef struct WcImpl <> impl Wc {
-//   char* Keyword; 
-//   int wordNum;
-// } WcImpl;
-// ----
-
 Wc* createWcImpl(struct Context* context, char* filename) {
     struct Wc* wc  = new Wc();
     struct WcImpl* wc_impl = new WcImpl();
@@ -47,6 +40,14 @@
     Count char
     TODO
     */
+  int N = 256;
+  char str[N];
+  int line = 0;
+  while(fgets(str, N, wc->file)!=NULL){
+    printf("%s",str);
+    line++;
+  }
+  printf("line = %d", line);
   goto countUp(wc, next);
 }