Last active
January 18, 2019 09:08
-
-
Save hjr265/c86630924ab42d25fadc5d818a0ceee4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <fcntl.h> | |
int main() { | |
FILE *pfin, *pfout; | |
pfin = fdopen(3, "r"); | |
pfout = fdopen(4, "w"); | |
fprintf(pfout, "A\n"); | |
fflush(pfout); | |
char x[10]; | |
fscanf(pfin, "%s", x); | |
printf("%s\n", x); | |
printf("\n"); | |
if(strcmp(x, "AA") == 0) { | |
printf("0\n"); | |
} else { | |
printf("1\n"); | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.write(4, 'A\n'.encode()) | |
y = os.read(3, 16) | |
print(y) | |
print() | |
if y == b'AA\n': | |
print(0) | |
else: | |
print(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = input() | |
print(x*2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment