diff --git a/lab02/add b/lab02/add new file mode 100755 index 0000000000000000000000000000000000000000..f2d0aaaba1eee7fbf1ed109b172305b70a5d8784 Binary files /dev/null and b/lab02/add differ diff --git a/lab02/add.c b/lab02/add.c new file mode 100644 index 0000000000000000000000000000000000000000..7c112f6e523b810a96bc8c247e4722d97af6e706 --- /dev/null +++ b/lab02/add.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +int main() +{ + int a,b; + int scret=0; + while(1) + { + scret = scanf("%d %d", &a,&b); + // printf("%d\n", scret); + if (scret == EOF) + break; + if (a == 9999) + break; + if (scret != 2) + { + fprintf(stderr, "Input Two Numbers\n"); + continue; + } + printf("%d \n", a+b); + } + return scret-2; +} diff --git a/lab02/all b/lab02/all new file mode 100644 index 0000000000000000000000000000000000000000..6f27d2dd34238294954c9be3ff09b43313c009d7 --- /dev/null +++ b/lab02/all @@ -0,0 +1,2 @@ +STDOUT: 100 +STDERR: 100 diff --git a/lab02/errfile b/lab02/errfile new file mode 100644 index 0000000000000000000000000000000000000000..b22717bfa9ce890d8f5e2f9094f98499db48c1f0 --- /dev/null +++ b/lab02/errfile @@ -0,0 +1 @@ +STDERR: 666 diff --git a/lab02/gen b/lab02/gen new file mode 100755 index 0000000000000000000000000000000000000000..814d2160f3e3e5eb848bac0ed720ebe432ac627d Binary files /dev/null and b/lab02/gen differ diff --git a/lab02/gen.c b/lab02/gen.c new file mode 100644 index 0000000000000000000000000000000000000000..82d7d3747b80054acc435213529fe3ebdcdd7cb5 --- /dev/null +++ b/lab02/gen.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +int main() +{ + int a,b; + int scret=0; + setvbuf(stdout, NULL, _IOLBF,5); + while(1) + { + scret = scanf("%d %d", &a, &b); + if (scret == EOF || a== 9999) + break; + printf("%d %d ", a, b); + } + return scret; +} diff --git a/lab02/hello3.c b/lab02/hello3.c new file mode 100644 index 0000000000000000000000000000000000000000..a4dd43477273b6a31ef4082a364c98996b5fe0eb --- /dev/null +++ b/lab02/hello3.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +int main() +{ + int a=0; + int scanfret=0; + setvbuf(stdout, NULL, _IONBF, 5); + // fflush(stdout); + while (1) + { + scanfret = fscanf(stdin,"%d",&a); + if (scanfret ==EOF ) + break; + fprintf(stdout,"STDOUT: %d\n", a); + fprintf(stderr,"STDERR: %d\n", a); + if ( a == 9999 ) + break; + } + return a; +} diff --git a/lab02/infile b/lab02/infile new file mode 100644 index 0000000000000000000000000000000000000000..ebc4bdc11a2ffa4b54e6076678b2b82b36fbf520 --- /dev/null +++ b/lab02/infile @@ -0,0 +1 @@ +100 200 300 diff --git a/lab02/lserr b/lab02/lserr new file mode 100644 index 0000000000000000000000000000000000000000..cd854aa67fdef589441b0e6e0ead2116a7b3433f --- /dev/null +++ b/lab02/lserr @@ -0,0 +1,3 @@ +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory diff --git a/lab02/outfile b/lab02/outfile new file mode 100644 index 0000000000000000000000000000000000000000..13240b36f363bbf0c320937048cf5dc308d496a8 --- /dev/null +++ b/lab02/outfile @@ -0,0 +1 @@ +STDOUT: 666 diff --git a/lab02/tlserr b/lab02/tlserr new file mode 100644 index 0000000000000000000000000000000000000000..763054937edb0e0a6b2e2adac426c6d5538953e0 --- /dev/null +++ b/lab02/tlserr @@ -0,0 +1,4 @@ +This is ls ERROR mew +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory diff --git a/lab03/add b/lab03/add new file mode 100755 index 0000000000000000000000000000000000000000..f2d0aaaba1eee7fbf1ed109b172305b70a5d8784 Binary files /dev/null and b/lab03/add differ diff --git a/lab03/add.c b/lab03/add.c new file mode 100644 index 0000000000000000000000000000000000000000..7c112f6e523b810a96bc8c247e4722d97af6e706 --- /dev/null +++ b/lab03/add.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +int main() +{ + int a,b; + int scret=0; + while(1) + { + scret = scanf("%d %d", &a,&b); + // printf("%d\n", scret); + if (scret == EOF) + break; + if (a == 9999) + break; + if (scret != 2) + { + fprintf(stderr, "Input Two Numbers\n"); + continue; + } + printf("%d \n", a+b); + } + return scret-2; +} diff --git a/lab03/all b/lab03/all new file mode 100644 index 0000000000000000000000000000000000000000..6f27d2dd34238294954c9be3ff09b43313c009d7 --- /dev/null +++ b/lab03/all @@ -0,0 +1,2 @@ +STDOUT: 100 +STDERR: 100 diff --git a/lab03/errfile b/lab03/errfile new file mode 100644 index 0000000000000000000000000000000000000000..b22717bfa9ce890d8f5e2f9094f98499db48c1f0 --- /dev/null +++ b/lab03/errfile @@ -0,0 +1 @@ +STDERR: 666 diff --git a/lab03/gen b/lab03/gen new file mode 100755 index 0000000000000000000000000000000000000000..814d2160f3e3e5eb848bac0ed720ebe432ac627d Binary files /dev/null and b/lab03/gen differ diff --git a/lab03/gen.c b/lab03/gen.c new file mode 100644 index 0000000000000000000000000000000000000000..82d7d3747b80054acc435213529fe3ebdcdd7cb5 --- /dev/null +++ b/lab03/gen.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +int main() +{ + int a,b; + int scret=0; + setvbuf(stdout, NULL, _IOLBF,5); + while(1) + { + scret = scanf("%d %d", &a, &b); + if (scret == EOF || a== 9999) + break; + printf("%d %d ", a, b); + } + return scret; +} diff --git a/lab03/hello3.c b/lab03/hello3.c new file mode 100644 index 0000000000000000000000000000000000000000..a4dd43477273b6a31ef4082a364c98996b5fe0eb --- /dev/null +++ b/lab03/hello3.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +int main() +{ + int a=0; + int scanfret=0; + setvbuf(stdout, NULL, _IONBF, 5); + // fflush(stdout); + while (1) + { + scanfret = fscanf(stdin,"%d",&a); + if (scanfret ==EOF ) + break; + fprintf(stdout,"STDOUT: %d\n", a); + fprintf(stderr,"STDERR: %d\n", a); + if ( a == 9999 ) + break; + } + return a; +} diff --git a/lab03/infile b/lab03/infile new file mode 100644 index 0000000000000000000000000000000000000000..ebc4bdc11a2ffa4b54e6076678b2b82b36fbf520 --- /dev/null +++ b/lab03/infile @@ -0,0 +1 @@ +100 200 300 diff --git a/lab03/lserr b/lab03/lserr new file mode 100644 index 0000000000000000000000000000000000000000..cd854aa67fdef589441b0e6e0ead2116a7b3433f --- /dev/null +++ b/lab03/lserr @@ -0,0 +1,3 @@ +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory diff --git a/lab03/outfile b/lab03/outfile new file mode 100644 index 0000000000000000000000000000000000000000..13240b36f363bbf0c320937048cf5dc308d496a8 --- /dev/null +++ b/lab03/outfile @@ -0,0 +1 @@ +STDOUT: 666 diff --git a/lab03/ps.sh b/lab03/ps.sh new file mode 100644 index 0000000000000000000000000000000000000000..8fb7d9223721cb4c6cb4e0aff8192156ee5f2f5b --- /dev/null +++ b/lab03/ps.sh @@ -0,0 +1,2 @@ +{ sleep 100; echo "100 seconds" ;} & +ps -l diff --git a/lab03/teeout b/lab03/teeout new file mode 100644 index 0000000000000000000000000000000000000000..1746327fc85690f82bb173183219c627f4b5e2aa --- /dev/null +++ b/lab03/teeout @@ -0,0 +1 @@ +200 200 300 300 \ No newline at end of file diff --git a/lab03/tlserr b/lab03/tlserr new file mode 100644 index 0000000000000000000000000000000000000000..763054937edb0e0a6b2e2adac426c6d5538953e0 --- /dev/null +++ b/lab03/tlserr @@ -0,0 +1,4 @@ +This is ls ERROR mew +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory +ls: cannot access 'infile': No such file or directory