Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3021

LCT File To BMP Image

$
0
0
Hi,

I have an *.lct file. I like to read *.lct file and save an bmp image.

I can not read this file using usual file read.

Code:

void CLCTtoBMPDlg::OnBnClickedReadlctfile()
{
        CFileException CFileEx;
        CStdioFile ReadFile;
        CString OpenlctfilePath;
        TCHAR szFilters[]= _T("LCT Files (*.lct)");
 
        CFileDialog fileDlg(TRUE, _T("bmp"), _T("*.lct"), OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilters);
   
  fileDlg.m_ofn.lpstrTitle = _T("lct Files");
  fileDlg.m_pOFN->lpstrInitialDir=_T("D:\\"); 

  if(fileDlg.DoModal() == IDOK)
  {
      OpenlctfilePath = fileDlg.GetPathName();
          MessageBox(OpenImageFilePath);
         
          CFileException CfileEx;       
          CStdioFile ReadFile;                   
          if(!ReadFile.Open(OpenlctfilePath, CFile::modeNoTruncate | CFile::modeRead, &CfileEx))
          {
                CFileEx.ReportError();
                MessageBox(_T("Setting File Was Not Found"));
                return ;
          }

                TRY
                {
                        CString sLine;
                        int iLineCount = 0;
                                       
                        while(ReadFile.ReadString(sLine))
                        {                       
                                ::AfxMessageBox(sLine);                                       
                        }                               
                        ReadFile.Close();
                }
                CATCH (CFileException, e)
                {
                        AfxMessageBox(_T("File could not be opened %d"),e->m_cause);
                        return ;
                }
                END_CATCH 
        }
}

Find the attachment. change the file extension *.lct instead of *.txt. I like to read ASCII Data into Hex,
Example : Data "A" as "41" (Refer the jpeg image). How is possible?
Attached Images
 
Attached Files

Viewing all articles
Browse latest Browse all 3021

Trending Articles