• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IO函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IO函数的典型用法代码示例。如果您正苦于以下问题:C++ IO函数的具体用法?C++ IO怎么用?C++ IO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IO函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: read_nvnunrnl

/** read solution sizes */
static int read_nvnunrnl (hid_t file_id, int *nv, int *nr, int *nl)
{
  if (H5Lexists (file_id, "/fclib_global", H5P_DEFAULT))
  {
    IO (H5LTread_dataset_int (file_id, "/fclib_global/M/n", nv));
    IO (H5LTread_dataset_int (file_id, "/fclib_global/H/n", nr));
    if (H5Lexists (file_id, "/fclib_global/G", H5P_DEFAULT))
    {
      IO (H5LTread_dataset_int (file_id, "/fclib_global/G/n", nl));
    }
    else *nl = 0;
  }
  else if (H5Lexists (file_id, "/fclib_local", H5P_DEFAULT))
  {
    *nv = 0;
    IO (H5LTread_dataset_int (file_id, "/fclib_local/W/n", nr));
    if (H5Lexists (file_id, "/fclib_local/R", H5P_DEFAULT))
    {
      IO (H5LTread_dataset_int (file_id, "/fclib_local/R/n", nl));
    }
    else *nl = 0;
  }
  else
  {
    fprintf (stderr, "ERROR: neither global nor local problem has been stored. Global or local have to be stored before solutions or guesses\n");
    return 0;
  }

  return 1;
}
开发者ID:xhub,项目名称:fclib,代码行数:31,代码来源:fclib.c


示例2: arc_pipe_from

AFFEND

/* XXX - when a file handle opened by pipe-from is up for gc it uses
   fclose instead of pclose! */
value arc_pipe_from(arc *c, value cmd)
{
  FILE *fp;
  int len;
  char *cmdstr;
  value ffp;

  TYPECHECK(cmd, T_STRING);
  len = FIX2INT(arc_strutflen(c, cmd));
  cmdstr = (char *)alloca(sizeof(char)*(len+1));
  arc_str2cstr(c, cmd, cmdstr);

  fp = popen(cmdstr, "r");
  if (fp == NULL) {
    int en = errno;
    arc_err_cstrfmt(c, "pipe-from: error executing command \"%s\", (%s; errno=%d)", cmdstr, strerror(en), en);
  }
  ffp = mkfio(c, T_INPORT, fp, cmd);
  IO(ffp)->io_ops = VINDEX(VINDEX(c->builtins, BI_io), BI_io_pfp);
  IO(ffp)->io_tfn = &procio_tfn;
  return(ffp);
}
开发者ID:qyqx,项目名称:arcueid,代码行数:26,代码来源:fileio.c


示例3: io_marker

static void io_marker(arc *c, value v, int depth,
		      void (*markfn)(arc *, value, int))
{
  markfn(c, IO(v)->name, depth);
  markfn(c, IO(v)->io_ops, depth);
  IO(v)->io_tfn->marker(c, v, depth, markfn);
}
开发者ID:GrimDerp,项目名称:arcueid,代码行数:7,代码来源:io.c


示例4: AFFDEF

static AFFDEF(io_pprint)
{
  AARG(sexpr, disp, fp);
  AOARG(visithash);
  AVAR(dw, wc);
  AFBEGIN;

  WV(dw, arc_mkaff(c, __arc_disp_write, CNIL));
  WV(wc, arc_mkaff(c, arc_writec, CNIL));
  if (TYPE(AV(sexpr)) == T_INPORT) {
    AFCALL(AV(dw), arc_mkstringc(c, "#<input-port:"), CTRUE,
	   AV(fp), AV(visithash));
  } else if (TYPE(AV(sexpr)) == T_OUTPORT) {
    AFCALL(AV(dw), arc_mkstringc(c, "#<output-port:"), CTRUE,
	   AV(fp), AV(visithash));
  } else {
    AFCALL(AV(dw), arc_mkstringc(c, "#<unknown-port:"), CTRUE,
	   AV(fp), AV(visithash));
  }
  if (!NIL_P(IO(AV(sexpr))->name)) {
    AFCALL(AV(dw), IO(AV(sexpr))->name, CTRUE,
	   AV(fp), AV(visithash));
  }
  if (IO(AV(sexpr))->io_tfn->pprint != NULL) {
    AFCALL(arc_mkaff(c, IO(AV(sexpr))->io_tfn->pprint, CNIL), AV(sexpr),
	   AV(disp), AV(fp), AV(visithash));
  }
  AFCALL(AV(wc), arc_mkchar(c, '>'), AV(fp));
  ARETURN(CNIL);
  AFEND;
}
开发者ID:GrimDerp,项目名称:arcueid,代码行数:31,代码来源:io.c


示例5: HWI2C_Transfer_read

char HWI2C_Transfer_read(char bank, char regAdd, char RegVal) 
{
	volatile t_ReqMb5 *p_ReqMB5;
	volatile t_AckMb5 *p_AckMB5;
	volatile unsigned data;
		
  p_ReqMB5  = (t_ReqMb5*)(TCDM_BASE+0xE44); 
  p_AckMB5  = (t_AckMb5*)(TCDM_BASE+0xDF4);
  	
	p_ReqMB5->un.I2CopType = I2CRead;
	p_ReqMB5->un.SlaveAdd = (bank&0x1F)|0x20;		  // To be used with AB8500V2	
	//p_ReqMB5->un.SlaveAdd = bank;								// To be used with AB8500V1
	p_ReqMB5->un.HwGCEn = 0;
	p_ReqMB5->un.StopEn = 1;
	p_ReqMB5->un.RegAdd = regAdd;
	p_ReqMB5->un.RegVal = RegVal;
	
	// Send mb5 (IT17) interrupt
	IO(0x80157100) = 0x20;
	
	// Check IT for ackMB5
	while((IO(0x80157494) & 0x20) != 0x20);

  data = (p_AckMB5->un.RegVal) & 0xFF;

	// Clear IT1 ackmb5
	IO(0x8015748C)=0x20;
	
	return(data);
	
}
开发者ID:12019,项目名称:vendor_st-ericsson_u8500,代码行数:31,代码来源:db8500b0_soc_settings_toshiba_400mhz.c


示例6: write_solution

/** write solution */
static void write_solution (hid_t id, struct fclib_solution *solution, hsize_t nv, hsize_t nr, hsize_t nl)
{
  if (nv) IO (H5LTmake_dataset_double (id, "v", 1, &nv, solution->v));
  if (nl) IO (H5LTmake_dataset_double (id, "l", 1, &nl, solution->l));

  ASSERT (nr, "ERROR: contact constraints must be present");
  IO (H5LTmake_dataset_double (id, "u", 1, &nr, solution->u));
  IO (H5LTmake_dataset_double (id, "r", 1, &nr, solution->r));
}
开发者ID:xhub,项目名称:fclib,代码行数:10,代码来源:fclib.c


示例7: extract

int extract(FILE *f, ArchFileInfo *info, char *fileName) {
  LOGGING_FUNC_START;
  int _error = 0;
  FILE *fOut = NULL;
  char *buf = malloc(BUF_SIZE*sizeof(char));
  char *buf2Write = malloc(BUF_SIZE*sizeof(char)*8);
  size_t lenBits = 0;
  size_t readBytes = 0;
  size_t returnBytes = 0;
  size_t readedBytes = 0;
  size_t howManyBytesRead = 0;
  Tree *haffTree = NULL;

  if (NULL == (fOut = fopen(fileName, "wb"))) {
    IO(L"Couldnt open file `%s`", fileName);
    __forErrorFileName = fileName;
    LOGGING_FUNC_STOP;
    return FILE_OPEN_ERROR;
  }

  haffTree = decodeTree(info->haffTree,info->haffTreeSize);
  initDecoding(haffTree);

  for (readedBytes=0; readedBytes < info->dataSize;) {
    howManyBytesRead = min(BUF_SIZE, (info->dataSize - readedBytes));
    _error = readNBytes(f, howManyBytesRead, buf, &readBytes);

    readedBytes += readBytes;

    if (_error) {
      IO(L"Error reading archive file");
      LOGGING_FUNC_STOP;
      return ARCHIVE_ERROR;
    }

    lenBits = (howManyBytesRead < BUF_SIZE)
              ? readBytes*8 - info->endUnusedBits
              : readBytes*8;

    decode(buf,lenBits,buf2Write,&returnBytes);

    _error = writeNBytes(fOut, returnBytes, buf2Write);

    if (_error) {
      IO("Write error to `%s`", fileName);
      __forErrorFileName = fileName;
      return _error;
    }
  }

  fclose(fOut);

  free(haffTree);
  LOGGING_FUNC_STOP;
  return 0;
}
开发者ID:ktulhy-kun,项目名称:hare,代码行数:56,代码来源:extract.c


示例8: init_encoder

void init_encoder() {
  DDR(PINDEF_ENCA) &= ~(_BV(IO(PINDEF_ENCA)) | _BV(IO(PINDEF_ENCB)));
  // Init is called before interrupts are enabled.
  set_encoder_count_dangerous(0);
  // Set up interrupt.
  PCMSK0 = _BV(PCINT0) | _BV(PCINT4);
  // Just in case.
  PCIFR = _BV(PCIF0);
  // Enable.
  PCICR = _BV(PCIE0);
}
开发者ID:nikitakit,项目名称:tenshi-old,代码行数:11,代码来源:encoder.c


示例9: __arc_allocio

/* Make a bare I/O object.  Note that one must populate the io_ops structure
   to be able to use it. */
value __arc_allocio(arc *c, int type, struct typefn_t *tfn, size_t xdsize)
{
  value io;

  io = arc_mkobject(c, sizeof(struct io_t) - sizeof(char) + xdsize, type);
  IO(io)->name = CNIL;
  IO(io)->flags = 0;
  IO(io)->io_tfn = tfn;
  IO(io)->ungetrune = -1;
  IO(io)->io_ops = CNIL;
  return(io);
}
开发者ID:GrimDerp,项目名称:arcueid,代码行数:14,代码来源:io.c


示例10: Modem_STM_config

///////////////////////////////////////
//Modem trace configuration
///////////////////////////////////////
void Modem_STM_config()
{
	//; ##########################################
	//; #       Configure GPIO for STM Modem
	//; ##########################################
	//; Configure GPIOs 70 to 76 in AltCx mode (AltA + AltB = AltC) 
	IO(0x8000e020) |= 0x00001FC0; //GPIO 70 to 76 AFSELA
	IO(0x8000e024) |= 0x00001FC0; //GPIO 70 to 76 AFSELB
	
	//; ##########################################
	//; #       Configure PRCMU for STM Modem
	//; ##########################################
	IO(0x80157138) |= 0x00000801; //Enable AltC3 for STM Modem signals on GPIOs 70 -> 76
}
开发者ID:12019,项目名称:vendor_st-ericsson_u8500,代码行数:17,代码来源:db8500b0_soc_settings_toshiba_400mhz.c


示例11: mkfio

AFFEND

static value mkfio(arc *c, int type, FILE *fd, value name)
{
  value fio;

  fio = __arc_allocio(c, type, &fileio_tfn, sizeof(struct fileio_t));
  IO(fio)->flags = 0;
  IO(fio)->io_ops = VINDEX(VINDEX(c->builtins, BI_io), BI_io_fp);
  IO(fio)->name = name;
  FIODATA(fio)->closed = 0;
  FIODATA(fio)->fp = fd;
  return(fio);
}
开发者ID:qyqx,项目名称:arcueid,代码行数:14,代码来源:fileio.c


示例12: read_local_vectors

/** read local vectors */
static void read_local_vectors (hid_t id, struct fclib_local *problem)
{
  MM (problem->q = malloc (sizeof (double [problem->W->m])));
  IO (H5LTread_dataset_double (id, "q", problem->q));

  ASSERT (problem->W->m % problem->spacedim == 0, "ERROR: number of W rows is not divisble by the spatial dimension");
  MM (problem->mu = malloc (sizeof (double [problem->W->m / problem->spacedim])));
  IO (H5LTread_dataset_double (id, "mu", problem->mu));

  if (problem->R)
  {
    MM (problem->s = malloc (sizeof (double [problem->R->m])));
    IO (H5LTread_dataset_double (id, "s", problem->s));
  }
}
开发者ID:xhub,项目名称:fclib,代码行数:16,代码来源:fclib.c


示例13: DRV_SPI_WriteByte

/******************************************************************************
 * FUNCTION NAME:
 *      DRV_SPI_WriteByte
 * DESCRIPTION:
 *      Write 1 Bytes data, via SPI Bus.
 * PARAMETERS:
 *      vData : Write data buffer.
 * RETURN:
 *      N/A
 * NOTES:
 *      N/A
 * HISTORY:
 *      2009.5.26        Panda.Xiong         Create/Update
 *****************************************************************************/
void DRV_SPI_WriteByte(IN UINT8 vData)
{
	UINT8   vBitIndex;

    for (vBitIndex = 8; vBitIndex != 0; vBitIndex--)
    {
        /* Transmitting data, MSB first, LSB last */
        CROL(vData, 1);
        DRV_SPI_IO_Write(IO(SPI_MOSI), (vData & 0x1));

        /* Generate one clock, to tell SPI Slave one bit data is ready */
        DRV_SPI_IO_Write(IO(SPI_SCK), IO_SPI_SCK_ACTIVE);
        DRV_SPI_FixWriteDutyCycle();
        DRV_SPI_IO_Write(IO(SPI_SCK), IO_SPI_SCK_INACTIVE);
	}
}
开发者ID:emcute0319,项目名称:at89-base,代码行数:30,代码来源:drv_spi.c


示例14: fileStream

bool YSE::DSP::fileBuffer::save(const char * fileName) {
  std::string fn = fileName;
  fn += ".wav";

  if (IO().getActive()) {
    return false; // not implemented yet
  }
  else {
    // check if file exists
    /*File file;
    file = File::getCurrentWorkingDirectory().getChildFile(fn.c_str());
    file.deleteFile();
    ScopedPointer<FileOutputStream> fileStream(file.createOutputStream());

    if (fileStream != nullptr) {
      WavAudioFormat wavFormat;
      AudioFormatWriter * writer = wavFormat.createWriterFor(fileStream, SAMPLERATE, 1, 16, StringPairArray(), 0);

      if (writer != nullptr) {
        fileStream.release();

        float ** array = new float*[1];
        array[0] = getPtr();

        writer->writeFromFloatArrays(array, 1, getLength());
        writer->flush();
        delete[] array;
      }
    }
	*/
  }

  return true;
}
开发者ID:yvanvds,项目名称:yse-soundengine,代码行数:34,代码来源:fileBuffer.cpp


示例15: IO

//---------------------------------------------------------------------------//
  void SerialSaver::IO(std::string& p_Value) 
  {
    uint32_t lgth = p_Value.length();
    IO(lgth);
    if (lgth > 0)
        m_streamer->Write(p_Value.c_str(), lgth);
  }
开发者ID:ImaginationZ,项目名称:DNApainter,代码行数:8,代码来源:serializer.cpp


示例16: LogImpl

void YSE::INTERNAL::soundFile::loadNonStreaming() {
  // load non streaming sounds in one go
  ScopedPointer<AudioFormatReader> reader;
  File file;

  if (IO().getActive()) {
    // will be deleted by AudioFormatReader
    customFileReader * cfr = new customFileReader;
    cfr->create(fileName.c_str());
    reader = SOUND::Manager().getReader(cfr);
  }
  else {
    file = File::getCurrentWorkingDirectory().getChildFile(juce::String(fileName));
    reader = SOUND::Manager().getReader(file);
  }

  if (reader != nullptr) {
    _fileBuffer.setSize(reader->numChannels, (Int)reader->lengthInSamples);
    reader->read(&_fileBuffer, 0, (Int)reader->lengthInSamples, 0, true, true);
    // sample rate adjustment
    _sampleRateAdjustment = static_cast<Flt>(reader->sampleRate) / static_cast<Flt>(SAMPLERATE);
    _length = _fileBuffer.getNumSamples();
    _buffer = _fileBuffer.getArrayOfReadPointers();
    _channels = _fileBuffer.getNumChannels();

    // file is ready for use now
    state = READY;
  }
  else {
    LogImpl().emit(E_FILEREADER, "Unable to read " + file.getFullPathName().toStdString());
    state = INVALID;
  }
}
开发者ID:yvanvds,项目名称:yse-soundengine,代码行数:33,代码来源:juceSoundFile.cpp


示例17: tee_time_rtt_interrupt

void tee_time_rtt_interrupt(void)
{
	if (IO(RTT0_MIS) & RTT_MIS_MIS)
		tee_time_rtt0_wrap++;

	/* No need to clear the interrupt as ROM code is handling that. */
}
开发者ID:hsibert,项目名称:optee_os,代码行数:7,代码来源:tee_time_unpg.c


示例18: main

int main()
{
    init();
    IO();
    grammar();
    return 0;
}
开发者ID:ltf1320,项目名称:programdesign,代码行数:7,代码来源:main.cpp


示例19: read_global_vectors

/** read global vectors */
static void read_global_vectors (hid_t id, struct fclib_global *problem)
{
  MM (problem->f = malloc (sizeof (double [problem->M->m])));
  IO (H5LTread_dataset_double (id, "f", problem->f));

  ASSERT (problem->H->n % problem->spacedim == 0, "ERROR: number of H columns is not divisble by the spatial dimension");
  MM (problem->w = malloc (sizeof (double [problem->H->n])));
  MM (problem->mu = malloc (sizeof (double [problem->H->n / problem->spacedim])));
  IO (H5LTread_dataset_double (id, "w", problem->w));
  IO (H5LTread_dataset_double (id, "mu", problem->mu));

  if (problem->G)
  {
    MM (problem->b = malloc (sizeof (double [problem->G->n])));
    IO (H5LTread_dataset_double (id, "b", problem->b));
  }
}
开发者ID:xhub,项目名称:fclib,代码行数:18,代码来源:fclib.c


示例20: KO

void CSharpTabCodeGen::LOCATE_TRANS()
{
    out <<
        "	_keys = " << KO() + "[" + vCS() + "]" << ";\n"
        "	_trans = " << CAST(transType) << IO() << "[" << vCS() << "];\n"
        "\n"
        "	_klen = " << SL() << "[" << vCS() << "];\n"
        "	if ( _klen > 0 ) {\n"
        "		" << signedKeysType << " _lower = _keys;\n"
        "		" << signedKeysType << " _mid;\n"
        "		" << signedKeysType << " _upper = " << CAST(signedKeysType) <<
        " (_keys + _klen - 1);\n"
        "		while (true) {\n"
        "			if ( _upper < _lower )\n"
        "				break;\n"
        "\n"
        "			_mid = " << CAST(signedKeysType) <<
        " (_lower + ((_upper-_lower) >> 1));\n"
        "			if ( " << GET_WIDE_KEY() << " < " << K() << "[_mid] )\n"
        "				_upper = " << CAST(signedKeysType) << " (_mid - 1);\n"
        "			else if ( " << GET_WIDE_KEY() << " > " << K() << "[_mid] )\n"
        "				_lower = " << CAST(signedKeysType) << " (_mid + 1);\n"
        "			else {\n"
        "				_trans += " << CAST(transType) << " (_mid - _keys);\n"
        "				goto _match;\n"
        "			}\n"
        "		}\n"
        "		_keys += " << CAST(keysType) << " _klen;\n"
        "		_trans += " << CAST(transType) << " _klen;\n"
        "	}\n"
        "\n"
        "	_klen = " << RL() << "[" << vCS() << "];\n"
        "	if ( _klen > 0 ) {\n"
        "		" << signedKeysType << " _lower = _keys;\n"
        "		" << signedKeysType << " _mid;\n"
        "		" << signedKeysType << " _upper = " << CAST(signedKeysType) <<
        " (_keys + (_klen<<1) - 2);\n"
        "		while (true) {\n"
        "			if ( _upper < _lower )\n"
        "				break;\n"
        "\n"
        "			_mid = " << CAST(signedKeysType) <<
        " (_lower + (((_upper-_lower) >> 1) & ~1));\n"
        "			if ( " << GET_WIDE_KEY() << " < " << K() << "[_mid] )\n"
        "				_upper = " << CAST(signedKeysType) << " (_mid - 2);\n"
        "			else if ( " << GET_WIDE_KEY() << " > " << K() << "[_mid+1] )\n"
        "				_lower = " << CAST(signedKeysType) << " (_mid + 2);\n"
        "			else {\n"
        "				_trans += " << CAST(transType) << "((_mid - _keys)>>1);\n"
        "				goto _match;\n"
        "			}\n"
        "		}\n"
        "		_trans += " << CAST(transType) << " _klen;\n"
        "	}\n"
        "\n";
}
开发者ID:nginx-modules,项目名称:balancer,代码行数:56,代码来源:cstable.cpp



注:本文中的IO函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IOADDR函数代码示例发布时间:2022-05-30
下一篇:
C++ IN_Shutdown函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap