⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snimacbin.cpp

📁 pc loader for 8051 based microcomputers
💻 CPP
字号:
// SnimacBin.cpp: implementation of the CSnimacBin class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SnimacBin.h"

#include "Win32File.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSnimacBin::CSnimacBin(const std::string& nazivFajla)
: CSnimacFajl(nazivFajla)
{
}

CSnimacBin::CSnimacBin(CFile* pFajl)
: CSnimacFajl(pFajl)
{
}

CSnimacBin::~CSnimacBin()
{
}

void CSnimacBin::SnimiSledeciBajt(PRG::tBajt bajt, PRG::tAdresa adresa)
{
    std::string opis;
    if (!ProveriFajlPtr(opis)) throw CSnimacException(opis);

    const int BROJ_BAJTOVA = 1; // upisujem po jedan bajt
    BYTE buffer[BROJ_BAJTOVA];  // bafer za upis
    try {
        buffer[0] = bajt;
        pFajl_m->Write(buffer, sizeof(buffer));
    }
    catch (CFileException* e) {
        std::string tekstGreske = CWin32File::ExceptionToTxt(*e, "CFileException");
        e->Delete();
        throw CSnimacException(tekstGreske);
    }
    catch (...) {
        throw CSnimacException("error writing file");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -