本文整理汇总了C++中STR::read方法的典型用法代码示例。如果您正苦于以下问题:C++ STR::read方法的具体用法?C++ STR::read怎么用?C++ STR::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STR
的用法示例。
在下文中一共展示了STR::read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outfile
void testWriteRead3()
{
const char *filename = "TestSTR.testWriteRead3.txt";
STR stdfRecIn;
stdfRecIn.setContflg("10100101"); //CONT_FLG
stdfRecIn.setTestnum(123456); //TEST_NUM
stdfRecIn.setHeadnum(255); //HEAD_NUM
stdfRecIn.setSitenum(0); //SITE_NUM
stdfRecIn.setPsrref( 65535); //PSR_REF
stdfRecIn.setTestflg("00011000"); //TEST_FLG
stdfRecIn.setLogtyp( "LOG_TYP"); //LOG_TYP
stdfRecIn.setTesttxt("TEST_TXT"); //TEST_TXT
stdfRecIn.setAlarmid("ALARM_ID"); //ALARM_ID
stdfRecIn.setProgtxt("PROG_TXT"); //PROG_TXT
stdfRecIn.setRslttxt("RSLT_TXT"); //RSLT_TXT
stdfRecIn.setZval( 255); //Z_VAL
stdfRecIn.setFmuflg( "00000000"); //FMU_FLG: If the bit is set means the field is considered missing or not.
stdfRecIn.setMaskmap("111"); //MASK_MAP
stdfRecIn.setFalmap( "1111"); //FAL_MAP
stdfRecIn.setCyccnt( 123456); //CYC_CNT
stdfRecIn.settotfcnt(123456); //TOTF_CNT
stdfRecIn.settotlcnt(123456); //TOTL_CNT
stdfRecIn.setCycbase(5); //CYC_BASE
stdfRecIn.setBitbase(3); //BIT_BASE
stdfRecIn.setCondcnt(5); //COND_CNT
stdfRecIn.setLimcnt(3); //LIM_CNT
stdfRecIn.setCycsize(2); //CYC_SIZE
stdfRecIn.setPmrsize(2); //PMR_SIZE
stdfRecIn.setChnsize(2); //CHN_SIZE
stdfRecIn.setPatsize(2); //PAT_SIZE
stdfRecIn.setBitsize(2); //BIT_SIZE
stdfRecIn.setU1size (2); //U1_SIZE
stdfRecIn.setU2size (2); //U2_SIZE
stdfRecIn.setU3size (2); //U3_SIZE
stdfRecIn.setUtxsize(3); //UTX_SIZE
stdfRecIn.setCapbgn (65535); //CAP_BGN
stdfRecIn.setLimindx(0,0); //LIM_INDX
stdfRecIn.setLimindx(1,1); //LIM_INDX
stdfRecIn.setLimindx(2,2); //LIM_INDX
stdfRecIn.setLimspec(0,0); //LIM_SPEC
stdfRecIn.setLimspec(1,1); //LIM_SPEC
stdfRecIn.setLimspec(2,2); //LIM_SPEC
stdfRecIn.setCondlst(0,"a"); //COND_LST
stdfRecIn.setCondlst(1,"b"); //COND_LST
stdfRecIn.setCondlst(2,"c"); //COND_LST
stdfRecIn.setCondlst(3,"d"); //COND_LST
stdfRecIn.setCondlst(4,"e"); //COND_LST
stdfRecIn.setCycocnt(2); //CYCO_CNT
stdfRecIn.setCycofst(0,0); //CYC_OFST
stdfRecIn.setCycofst(1,1); //CYC_OFST
stdfRecIn.setPmrcnt (2); //PMR_CNT
stdfRecIn.setPmrindx(0,0); //PMR_INDX
stdfRecIn.setPmrindx(1,1); //PMR_INDX
stdfRecIn.setChncnt (2); //CHN_CNT
stdfRecIn.setChnnum (0,0); //CHN_NUM
stdfRecIn.setChnnum (1,1); //CHN_NUM
stdfRecIn.setExpcnt (2); //EXP_CNT
stdfRecIn.setExpdata(0,0); //EXP_DATA
stdfRecIn.setExpdata(1,1); //EXP_DATA
stdfRecIn.setCapcnt (2); //CAP_CNT
stdfRecIn.setCapdata(0,0); //CAP_DATA
stdfRecIn.setCapdata(1,1); //CAP_DATA
stdfRecIn.setNewcnt (2); //NEW_CNT
stdfRecIn.setNewdata(0,0); //NEW_DATA
stdfRecIn.setNewdata(1,1); //NEW_DATA
stdfRecIn.setPatcnt (2); //PAT_CNT
stdfRecIn.setPatnum (0,0); //PAT_NUM
stdfRecIn.setPatnum (1,1); //PAT_NUM
stdfRecIn.setBposcnt(2); //BPOS_CNT
stdfRecIn.setBitpos (0,0); //BIT_POS
stdfRecIn.setBitpos (1,1); //BIT_POS
stdfRecIn.setUsr1cnt(2); //USR1_CNT
stdfRecIn.setUsr1 (0,0); //USR1
stdfRecIn.setUsr1 (1,1); //USR1
stdfRecIn.setUsr2cnt(2); //USR2_CNT
stdfRecIn.setUsr2 (0,0); //USR2
stdfRecIn.setUsr2 (1,1); //USR2
stdfRecIn.setUsr3cnt(2); //USR3_CNT
stdfRecIn.setUsr3 (0,0); //USR3
stdfRecIn.setUsr3 (1,1); //USR3
stdfRecIn.setTxtcnt (3); //TXT_CNT
stdfRecIn.setUsertxt(0,"cn11111");//USER_TXT
stdfRecIn.setUsertxt(1,"cn22222");//USER_TXT
stdfRecIn.setUsertxt(2,"cn33333");//USER_TXT
std::ofstream outfile(filename, std::ofstream::binary);
stdfRecIn.write(outfile);
outfile.close();
TS_ASSERT_EQUALS(stdfRecIn.storage(), 198u)
STR stdfRecOut;
std::ifstream infile(filename, std::ifstream::binary);
stdfRecOut.read(infile);
outfile.close();
TS_ASSERT_EQUALS(stdfRecIn.storage(), stdfRecOut.storage())
std::vector<std::basic_string<char> > str;
stdfRecOut.to_string(str);
TS_ASSERT_EQUALS(str[0], "198");
TS_ASSERT_EQUALS(str[1], "15");
//.........这里部分代码省略.........