콤마로 구분된 텍스트 파일을 읽어서 메모리에 준비한다.
int @CsvBlockLoad(string filename, int column, int row, int encoding);
함수인자
string filename : 읽을 텍스트 파일 (전체파일 경로를 사용할 것)
int column : 읽을 파일의 열 갯수
int row : 읽을 파일의 행 개수
int encoding : 문자열 인코딩 (0=ASCII, 1=UTF8)
반환 값
파일을 여는 도중 오류가 발생하면 -1을 반환하고 그 이외의 값을 반환하면 연결번호이다.
예제
@DialogSetFilter("Csv files|*.csv|");
retn = @DialogFileOpen($filename);
if(retn == 1) {
@CsvBlockFree($ID);
$ID = @CsvBlockLoad($filename, 2, 50);
@CsvBlockSet($ID, "ex.txt", 0);
$Number = 0;
}
문장설명 : 파일열기 대화상자에서 파일을 선택하면 이전 블록을 풀어주고 (CsvBlockFree) 2열 50행 메모리로 파일을 불러온 다음 첫번째 행을 ex.txt 연결설정대로 태그 값을 적용한다.
관련항목