안녕하세요
gcc로 컴파일 하고 있는데, 문자열을 입력, 출력 할 때 자꾸 에러가 뜹니다
Visual Studio 및 우분투 GCC에서는 잘 되는데
여기서 답안 제출 하니깐 에러가 뜹니다
채점 중 예외가 발생했습니다.
익셉션:
스택 트레이스:
Traceback (most recent call last):
File "judge/tasks.py", line 190, in judge_submission
data_dir, sandbox_env):
File "judge/differs.py", line 74, in special_judge
sandbox.write_file(o, '_output')
File "judge/sandbox.py", line 201, in write_file
open(target, "w").write(text.encode("utf-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8d in position 34: ordinal not in range(128)
위와 같은 에러입니다
문제 되는 부분은 아래 부분으로 추정합니다
fgets(name[j], sizeof(name[j]), stdin);
name은 아래와 같이 선언했습니다
char name[100][20];
fgets 말고 scanf를 사용해도 동일한 에러가 뜨고 있습니다
문자열 입력을 어떻게 받고, 어떻게 출력해야 하는지 조언을 부탁 드립니다
감사합니다
hhhrock
안녕하세요
gcc로 컴파일 하고 있는데, 문자열을 입력, 출력 할 때 자꾸 에러가 뜹니다
Visual Studio 및 우분투 GCC에서는 잘 되는데
여기서 답안 제출 하니깐 에러가 뜹니다
채점 중 예외가 발생했습니다.
익셉션:
스택 트레이스:
Traceback (most recent call last):
File "judge/tasks.py", line 190, in judge_submission
data_dir, sandbox_env):
File "judge/differs.py", line 74, in special_judge
sandbox.write_file(o, '_output')
File "judge/sandbox.py", line 201, in write_file
open(target, "w").write(text.encode("utf-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8d in position 34: ordinal not in range(128)
위와 같은 에러입니다
문제 되는 부분은 아래 부분으로 추정합니다
fgets(name[j], sizeof(name[j]), stdin);
name은 아래와 같이 선언했습니다
char name[100][20];
fgets 말고 scanf를 사용해도 동일한 에러가 뜨고 있습니다
문자열 입력을 어떻게 받고, 어떻게 출력해야 하는지 조언을 부탁 드립니다
감사합니다
11년 전