[태그:] C Language


  • OpenCV 에서  imencode 사용했던 메모리 버퍼 파일 쓰기하면  …

    OpenCV 에서 imencode 사용했던 메모리 버퍼 파일 쓰기하면 …

    메모리에 저장했다가 제대로 되는지 테스트 겸 파일로 저장해보니 이런 이미지가 나오더라 그래서 뭐가 문제이지 삽질하다가 해결함 static int cntttt =0; cntttt++; sprintf (TextBuffer, “d:\image%d.jpg”, cntttt); { std::vector<int> qualityType; qualityType.push_back(CV_IMWRITE_JPEG_QUALITY); qualityType.push_back(90); cv::imencode(“.jpg”, imageROI, m_imbuf, qualityType); FILE* fp = NULL; fopen_s(&fp, TextBuffer,… “read more”


  • 폴더선택 다이얼로그와 초기폴더경로 설정

    폴더선택 다이얼로그와 초기폴더경로 설정

    이렇게 폴더 선택 다이얼로그가 필요해서 구글링 해서 여기 정리해둠 int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { switch (uMsg) { // 폴더선택 다이얼로그의 초기화가 끝난 경우 case BFFM_INITIALIZED: SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData); break; } return 0; }… “read more”


  • MFC에서 윈도우 특정 폴더 경로 구하기 (내문서나 기타등등)

    MFC 프로그래밍 하다가 특정 경로를 구해야 해서 방법을 검색해봤다. BOOL SHGetSpecialFolderPath( HWND hwndOwner, _Out_ LPTSTR lpszPath, _In_ int csidl, _In_ BOOL fCreate ); wchar_t szPath[MAX_PATH] = {0,}; SHGetSpecialFolderPath( NULL, szPath, CSIDL_MYDOCUMENTS, FALSE ); csidl 값에 따라 경로를 구해온다. 내 문서… “read more”


  • MFC에서 콘솔창 띄우기

    MFC로 뭔가 작성하다가 보니 안드로이드 개발할때 Log.d(“linsoo”,””); 이게 생각난다 간단하게 디버깅할때 값 출력하긴 이게 딱인데 그래서 콘솔창 쓰는법 없나 검색해보니 있다. #ifdef _DEBUG #pragma comment(linker, “/entry:WinMainCRTStartup /subsystem:console”) #endif 공통헤더파일에 이거 하나 추가해주면 디버깅모드로 작업시 항상 콘솔창이 추가로 뜨게 된다. “read more”


  • STL String에서 문자열 자르기

    template <typename Outit> int split(const std::wstring &pattern, const std::wstring &subject, Outit Dest){ std::wstring::size_type pattern_length = pattern.length(); std::wstring::size_type beginpos = 0; std::wstring::size_type endpos = subject.find(pattern); while (endpos != std::wstring::npos){ *Dest = subject.substr(beginpos, endpos-beginpos); beginpos = endpos + pattern_length; endpos = subject.find(pattern,… “read more”