Programming 56

process

참고 : https://opentutorials.org/module/938/7189 process 객체 node의 기본 모듈. global 모듈의 객체이다. process 객체의 속성 env : 컴퓨터 환경과 관련된 정보version : node.js 버전versions : 해당 노드 프로세스에서 사용하는 모듈들의 버전arch : 프로세서의 아키텍처 정보(arm/ia32/x64 ...) platform : 플랫폼 정보(OS) process 객체의 메서드 memoryUsage() : 메모리 사용 정보를 가진 객체uptime() : 현재 프로그램이 실행된 시간exit([code]) : 프로그램 종료 ( 정상적인 종료는 0, 비정상적인 종료는 1이 [code]이다.)

Programming/node.js 2015.05.11

fs

참고 : https://opentutorials.org/module/938/7373 fs 모듈 파일을 읽고 써주는 모듈. 파일 읽기 비동기적 : 파일을 읽으면서 다른 작업 가능 fs.readFile(filename, options, callback)options의 방식으로 파일을 읽은 후 callback으로 전달된 함수를 호출. 동기적 : 파일을 읽는 동안 다른 작업 불가능 fs.readFileSync(filename, options)options의 방식으로 파일을 읽은 후 문자열 반환. options에는 보통 인코딩 방식이 오고 utf-8을 주로 사용한다. 예제 var fs = require('fs'); var text = fs.readFileSync('text.txt', 'utf8');console...

Programming/node.js 2015.05.11

node.js 준비

1. node.js 공식 웹 사이트에서 msi 파일로 설치https://nodejs.org/ Linux$ sudo add-apt-repository ppa:chris-lea/node.js $ sudo apt-get update $ sudo apt-get install python-software-properties python g++ make nodejs $ sudo npm install -g bower supervisor grunt-cli karma karma-cli 2. node.js가 설치된 폴더에서 jade, express, express-generator, coffee-script 설치* express만 설치하면 모듈들만 설치되고 exrpess-generator를 설치해야지 binary 파일이 ..

Programming/node.js 2015.05.10

포인터와 배열의 관게

날 괴롭힌 난제들 중 하나인데.. 구글링 결과 대충(정말로 대충) 결과를 얻긴 얻었다. int *ptr[2]; int (*ptr)[2]; int *ptr[2]는 직역한 대로 '포인터 변수를 배열로 가진다'이고, int (*ptr)[2]는 'int xx[2]라는 배열 자체를 포인터하는 변수이다'라고 할 수 있다. 이 점 유의하고 시작하자. int n[2]; int (*ptr)[2]; p = n; //에러 p = &n[0]; //에러 p = &n; //정상 n, &n[0], &n은 모두 같은 값을 가지게 된다. 하지만 값이 같다고 무작정 쳐넣으면 안된다. 자료형이 다르기 때문이다. 정리하자면 n[0] 은 int &n[0] 은 int* n 은 int[] &n 은 int(*) [] 여기까지는 괜찮은데 그 다음부..

Programming/C_C++ 2012.02.23
반응형