Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
o-oChan authored Jun 25, 2024
0 parents commit 7a8430c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions problem1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// (1)번 위치에 그대로 넣으세요
if (FD_ISSET(STDIN_FILENO, &readfds)) {
if (fgets(buffer, BUFFER_SIZE, stdin) != NULL) {
buffer[strcspn(buffer, "\n")] = '\0'; // Remove newline character
if (strcmp(buffer, "\\quit") == 0) {
if (send(sock, "\\quit\n", strlen("\\quit\n"), 0) == -1) {
perror("send");
}
printf("gg~\n");
break;
}
if (strlen(buffer) > 0) {
if (send(sock, buffer, strlen(buffer), 0) == -1) {
perror("send");
}
if (send(sock, "\n", 1, 0) == -1) {
perror("send");
}
}
}
}

0 comments on commit 7a8430c

Please sign in to comment.