Use strtol in guess.c; UTF-8 in cat.py !2

merged merged by cmc on 2026-11-01 05:48 UTC · cmc/learn:scan-fixes into main

2 files changed, +2 −2

Layout: unified · split

c/guess.c +1 −1
@@ -24,7 +24,7 @@ int main() {
2424 if(fgets(line, sizeof line, stdin) != NULL)
2525 {
2626 // Convert user input to an integer
27 int user_input = atoi(line);
27 int user_input = (int)strtol(line, NULL, 10);
2828
2929 // Do the main comparison to determine if the guess is correct
3030 if (user_input == random_number) {
python/cat.py +1 −1
@@ -7,7 +7,7 @@ args = parser.parse_args()
77
88# Open the file using the `file` argument
99path = args.file
10with open(path, 'r') as file:
10with open(path, 'r', encoding='utf-8') as file:
1111 # Read and print the file contents
1212 contents = file.read()
1313 print(contents)