当前位置: 首页>>代码示例>>C++>>正文


C++ IO函数代码示例

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


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


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