summaryrefslogtreecommitdiff
path: root/hask-io/mini.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2019-03-02 12:50:34 +0100
committerMiguel <m.i@gmx.at>2019-03-02 12:50:34 +0100
commit76718c0ec3717c4f9e5b0f659ab829f4b92419d2 (patch)
treef0d5e17dc85c9dadd5e2e2e0dc73c24a5e2f4e92 /hask-io/mini.c
parenta97b3edf385a1fd69899ea8fe23889fa0d206079 (diff)
playing with some haskell code
Diffstat (limited to 'hask-io/mini.c')
-rw-r--r--hask-io/mini.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hask-io/mini.c b/hask-io/mini.c
new file mode 100644
index 0000000..eb5ba46
--- /dev/null
+++ b/hask-io/mini.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+int main(){
+ char buf[2048];
+ int a=0;
+ while(1){
+ size_t sz=fread(&buf,1,2048,stdin);
+ if(!sz)break;
+ for(size_t i=0;i<sz;i++){
+ a+=buf[i];
+ a%=256;
+ }
+ }
+ printf("%i\n",a);
+}