 |
|
| 이전 주제 보기 :: 다음 주제 보기 |
| 글쓴이 |
메시지 |
남기웅 손님
|
올려짐: 2007년10월7일 11:01 주제: Read, Write는 어떻게 해야되죠? |
|
|
| run 함수 안에서 어떻게 해야 외부하고 통신을 할 수 있는건지 모르겠어요... |
|
| 위로 |
|
 |
오학주
가입: 2005년 9월 5일 올린 글: 118
|
올려짐: 2007년10월7일 12:59 주제: |
|
|
run을 실행중에 standard input/output으로 값을 읽고 쓰면 되지 않을까요?
입력/출력은 nML의 입력/출력 함수를 이용하세요.
Input functions on standard input
val read_line : unit -> string
Flush standard output, then read characters from standard input until a newline character is encountered. Return the string of all characters read, without the newline character at the end.
val read_int : unit -> int
Flush standard output, then read one line from standard input and convert it to an integer. Raise Failure "int_of_string" if the line read is not a valid representation of an integer.
val read_real (read_float) : unit -> real
Flush standard output, then read one line from standard input and convert it to a real number. The result is unspecified if the line read is not a valid representation of a real number.
Output functions on standard output
val print_char : char -> unit
Print a character on standard output.
val print_string : string -> unit
Print a string on standard output.
val print_int : int -> unit
Print an integer, in decimal, on standard output.
val print_real (print_float) : real -> unit
Print a real number, in decimal, on standard output.
val print_endline : string -> unit
Print a string, followed by a newline character, on standard output.
val print_newline : unit -> unit
Print a newline character on standard output, and flush standard output. This can be used to simulate line buffering of standard output. |
|
| 위로 |
|
 |
남기웅 손님
|
올려짐: 2007년10월7일 13:20 주제: |
|
|
| 아 그렇게 하면 되는거군요. run에서 직접 입출력 하지 않고, 다른 모듈과 간접적으로 하는 것이 아닐까 하는 생각이 들었었거든요. 감사합니다. |
|
| 위로 |
|
 |
허기홍
가입: 2007년 9월 27일 올린 글: 231
|
올려짐: 2007년10월7일 14:46 주제: |
|
|
그런데 터미널 입출력을 다룰 대상이
우리가 갖고 있는 value 값 모두입니까??
아니면 Bool bool, Unit, 등도 해야하나요?
조교님이 주신 테스트 코드들에서는 정수 입출력만 되어 있습니다만... |
|
| 위로 |
|
 |
한재화
가입: 2007년 10월 6일 올린 글: 25
|
올려짐: 2007년10월7일 14:49 주제: 문제에 입출력은 정수만 가능하다고 되어있네요. |
|
|
pdf 파일에 exercise 2 문제 정의 끝에 보면.
| 인용: |
...
입출력은 정수만 가능합니다. 출력은 정수를 화면에 뿌리고 "newline"을 프린트합니다.
..
|
|
|
| 위로 |
|
 |
|
|
새로운 주제를 올릴 수 없습니다 답글을 올릴 수 없습니다 주제를 수정할 수 없습니다 올린 글을 삭제할 수 없습니다 투표를 할 수 없습니다
|
Powered by phpBB 2.0.21-7 (Debian) © 2001, 2005 phpBB Group Translated by kss & drssay
|