일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Binary
- public
- parameter
- Encapusulation
- wpf
- APP
- aduino
- Android
- stream
- length
- Contour
- UNO
- Read
- mfc
- inheritance
- compare
- flutter
- digitalRead
- Unity
- sensor
- java
- SERIAL
- Barcode
- memory
- Class
- file access
- Pointer
- Overloading
- preprocessing
- atmega328
- Today
- Total
목록file access (10)
폴크(FOLC)

# 파일 종류 > text file : 문자열의 모임으로 바로 확인 가능 ( TxT 뷰어 이용 ) > binary file : 0, 1의 이진 형식으로 바로 확인 불가능 ( 별도 뷰어 필요 ) # 파일은 stream(임시 메모리 공간)를 통해서 접근 > InputStream / PrintStream ( 파일 연동 ) > setin / setout 으로 사용자 데이터 송신, 수신 # 파일 연동 > HDD 에 저장되는 정보, 연속적인 byte 의 모임 > 메소드 이용 - canRead() : 파일을 읽을 수 있는 파일인지 확인 - canWrite() : 파일이 쓸수 있는 파일인지 확인 - exists() : 파일이 존재하는지 확인 # 예제 소스 public static main(String [] args) ..

# 파일 종류 > text file : 문자열의 모임으로 바로 확인 가능 ( TxT 뷰어 이용 ) > binary file : 0, 1의 이진 형식으로 바로 확인 불가능 ( 별도 뷰어 필요 ) # 파일은 stream(임시 메모리 공간)를 통해서 접근 > ifstream / ofstream ( 파일 연결 ) - ifstream ifs; ios_base::in 이 기본값 ( 읽기 상태 ) - ofstream ofs; ios_base::out | ios_base::trunc 이 기본값 ( 쓰기 상태 ) > cin / cout 으로 사용자 데이터 송신, 수신 - ifs >> buf : 한 문자를 읽어 buf 에 연동 - getline(buf, 100) : 한 줄을 읽어 buf 에 연동 # 파일 연동 > HDD ..

# 파일 종류 > text file : 문자열의 모임으로 바로 확인 가능 ( TxT 뷰어 이용 ) > binary file : 0, 1의 이진 형식으로 바로 확인 불가능 ( 별도 뷰어 필요 ) # 파일은 buffer (임시 메모리 공간)를 통해서 접근 > fully buffered ( 파일 연동 ) : 버퍼에 데이터를 더 이상 담지 못할때 보내는 방식 > line buffered ( 키보드 연동 ) : 버퍼에 데이터를 담고 개행 문자(\n) 가 담겼을때 보내는 방식 > buffer clear : fflush 명령어를 이용해서 버퍼 내용 삭제 - int fflush(FILE *stream); - 출력 스트림과 연결, NULL 포인터를 연결하면 내용을 삭제 - 정상 : 0, 실패 : EOF # 파일 연동 >..

# MFC를 이용하는 과정에서 HDD 에 존재하는 파일 ( txt format ) 제어 > Save, Load 형태 - CStdioFile 이용 > exe 파일 위치에 test.txt 파일 생성 # 소스 코드 bool CTxTFormHelper::ReadFile(CString strFileName) { std::vector vecParam; CStdioFile file; CFileException e; if (file.Open(strFileName, CFile::modeReadWrite | CFile::typeText, &e) == TRUE) { CString strReadData; while (file.ReadString(strReadData) == TRUE) { vecParam.push_back(st..

# MFC를 이용하는 과정에서 HDD 에 존재하는 파일 ( ini format ) 제어 > Save, Load 형태 - Shlwapi.lib 이용 > exe 파일 위치에 test.ini 파일 생성 # 소스 코드 > #include > #pragma comment(lib, "Shlwapi.lib") GetPrivateProfileInt(szCategory, szKey, nDefValue, m_strFilePath); WritePrivateProfileString(szCategory, szKey, strValue, m_strFilePath); > 읽기/쓰기 부분에 대한 내용을 별도로 wrapping 해서 이용한다. int CINIFormHelper::LoadINT(LPCTSTR szCategory, LPCT..

# MFC를 이용하는 과정에서 HDD 에 존재하는 파일 ( binary format ) 제어 > Save, Load 형태 - Map 형태 이용 > exe 파일 위치에 test.dat 파일 생성 # 소스 코드 m_pdbBinary = new CDataBaseBinary; bool CBINFormHelper::FileLoad() { CFile file; CFileException fe; if (file.Open(m_strFilePath, CFile::modeRead, &fe) == FALSE) { return false; } CArchiveUserDefine ar(&file, CArchive::load); BOOL bReturn = FALSE; if (m_pdbBinary) { delete m_pdbBina..

# WPF 를 이용하는 과정에서 HDD 에 존재하는 파일 ( csv format ) 제어 > Save, Load 형태 - StreamWriter, StreamReader 이용 > exe 파일 위치에 test.csv 파일 생성 # 소스 코드 using System.Collections; using System.Collections.Generic; using System.IO; public class CSVformat { struct CSVData { public string key; public string value; public CSVData(string _key, string _value) { _key= _key.Replace(",", " "); _value= _value.Replace(",", " ..

# WPF 를 이용하는 과정에서 HDD 에 존재하는 파일 ( binary format ) 제어 > Save, Load 형태 - List 형태 이용 > exe 파일 위치에 test.dat 파일 생성 # 소스 코드 using System.Runtime.Serialization.Formatters.Binary; public class BINformat { [Serializable] struct Data { public string key; public string value; public Data(string _key, string _value) { key= _key; value= _value; } } public void WriteReadTest() { string path = System.Reflectio..

# WPF 를 이용하는 과정에서 HDD 에 존재하는 파일 ( ini format ) 제어 > Save, Load 형태 - DllImport("kernel32") 이용 > exe 파일 위치에 test.ini 파일 생성 # 소스 코드 using System.Runtime.InteropServices; public class INIformat { DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filepath); DllImport("kernel32")] private static extern int GetPrivateProfileString..

# 이미지 또는 파일을 Upload 하기 위해서 권한이 부여 되지 않아 App 이 비정상적으로 종료되는 현상 > Storage 접근 권한 필요 > CAMERA 관련 권한 필요 # android - app - src - main - AndroidManifest.xml 에 내용 추가 > > # 스토리지 권한만 있으면 안되고 CAMERA 권한도 같이 부여 해줘야 한다. > 카메라 권한만 부여해도 정상 동작하는 경우가 있음. # 추가적으로, 사진이나 파일을 저장하기 위해서는 아래와 같은 구문 추가 > > android:requestLegacyExternalStorage="true" 또는 android:preserveLegacyExternalStorage="true" - 삭제 예정 * P.S. Android ta..