728x90
728x90
SMALL

파일 4

[C#] 파일 오픈 및 읽기/쓰기

1. 파일 읽기예제1) 텍스트 파일 읽기/// /// 파일의 내용을 문자열로 읽기 /// /// 파일경로 /// 파일내용(문자열)string ReadAllText(string path) {try { if (File.Exists(path)) { string rs = ""; using (StreamReader sr = new StreamReader(path)) { rs = sr.ReadToEnd(); Trace.WriteLine(path); } return rs; } else { Trace.WriteLine($"[{path}] 파일이 없습니다."); Trace.WriteLine(path); } Debug.Flush(); } catch (Exception ex) { Trace.WriteLine(ex.ToS..

유용한 정보 2025.04.15

[MSSql] varbinary 데이터를 파일로 저장하는 방법

명령문: bcp "select 이미지데이터컬럼명 from 스키마.테이블명 where 조건" queryout "저장할 파일의 전체경로" -S DB서버명 -d DB명 -U 사용자ID -P 사용자암호 명령문: bcp "select 이미지데이터컬럼명 from 데이터베이스명.스키마.테이블명 where 조건" queryout "저장할 파일의 전체경로" -T -n -S 데이터베이스서버명;   사용법: bcp {dbtable | query} {in | out | queryout | format} 데이터 파일  [-m 최대 오류 수]                  [-f 서식 파일]          [-e 오류 파일]  [-F 첫 행]                         [-L 마지막 행]          [-..

DB 관련 2024.12.27

[C++]파일 및 디렉토리 존재 여부 체크

// 파일의 존재여부 확인// 파라미터//nFlag = 1 (=default)이면 파일, 2이면 디렉토리인지, 0이면 파일 및 디렉토리를 검색BOOL isExists(const char* fname, int nFlag){if(fname == NULL)return FALSE;DWORD attr = GetFileAttributes(fname);#ifdef _DEBUG_LOG//CString str;//str.Format("%s = 0x%x (file?%d, dir?%d)", fname, attr,((attr & FILE_ATTRIBUTE_DIRECTORY) == 0), ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0));//MessageBox(NULL, str, "OK", MB_OK)..

유용한 정보 2024.12.25
728x90
728x90
LIST