- 임의의 문자열(파일)이 주어졌을 때 그 문자열(파일)의 한글코드가 무엇인지를 자동으로 인식하는 프로그램을 작성하시오.
<참고> loadfile.c의 함수 codescan() 의 내용을 완성
- codescan() 함수의 return value는 "EUCKR, UTF8, UTF16BE, UTF16LE, NONE" 중에서 하나
<과제 내용> loadfile.c를 수정하여 아래와 같이 옵션을 주어서 실행되도록 하시오.
loadfile2.c의 미완성된 함수들을 모두 완성
C> loadfile -x test.txt // $ od -x test.txt
C> loadfile -c test.txt // $ od -c test.txt
C> loadfile -o test.txt // $ od -o test.txt
C> loadfile -scan test.txt // 한글 코드 유형 detection
C> loadfile -dos test.txt // EOL을 모두 CR-LF로 출력
C> loadfile -unix test.txt // EOL을 모두 LF 문자로만 출력
loadfile2.c
첫댓글 <참고 1> Ubuntu에서 컴파일 에러가 발행할 때 main() 함수의 type을 추가해 주세요.
"main(...)" --> "int main(...)"
<참고 2> 코멘트 부분이 한글 완성형 코드인 문제로 컴파일이 안되면... 아래와 같이 코드변환하세요.
$ iconv -f cp949 -t utf8 loadfile.c > loadfile2.c