Showing
2 changed files
with
21 additions
and
0 deletions
gentxt.js
0 → 100644
| 1 | +var fs = require('fs');//파일 시스템 | ||
| 2 | +var readline=require('readline')//readline 모듈 | ||
| 3 | +var file = 'target.txt';//파일은 타겟.텍스트이다. | ||
| 4 | +var r=readline.createInterface({ | ||
| 5 | + input:process.stdin, output:process.stdout | ||
| 6 | +});//입출력 정의 | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +fs.open(file, 'r+', function(err,fd){//파일을 읽쓰 모드로 열고 없으면 에러발생 | ||
| 11 | + if (err) throw err; | ||
| 12 | + console.log('target open complete');//열고 출력 | ||
| 13 | + r.question("검색을 원하는 아이디를 입력하세요 : ",function(input){ | ||
| 14 | + console.log("입력완료",input); | ||
| 15 | + r.close() | ||
| 16 | + fs.writeFile('target.txt',input,'utf8',function(error){ | ||
| 17 | + console.log('writing done') | ||
| 18 | + }) | ||
| 19 | + }) | ||
| 20 | +}) |
target.txt
0 → 100644
| 1 | +3303221 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment