Skip to content

Instantly share code, notes, and snippets.

@hjr265
Last active January 18, 2019 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hjr265/c86630924ab42d25fadc5d818a0ceee4 to your computer and use it in GitHub Desktop.
Save hjr265/c86630924ab42d25fadc5d818a0ceee4 to your computer and use it in GitHub Desktop.
#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;
}
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)
x = input()
print(x*2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment