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

C++ save_file函数代码示例

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

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



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

示例1: Attribute

		bool XUI_Window::SaveToXMLNode( TiXmlNode* pNode )
		{
			TiXmlElement* pElement = pNode->ToElement();

			TiXmlElement Attribute( "attribute" );
			if( save_file( &Attribute ) == false ) return false;
			pNode->InsertEndChild( Attribute );


			std::vector<XUI_Wnd*>::const_iterator citer = m_pChildren.begin();
			while( citer != m_pChildren.end() )
			{
				XUI_Wnd* pXUI_Wnd = *citer;
				TiXmlElement XmlElement("control");
				XmlElement.SetAttribute( "lable", typeid( pXUI_Wnd ).name() );
				if( typeid( pXUI_Wnd ) == typeid(XUI_Window) )
					((XUI_Window*)pXUI_Wnd)->SaveToXMLNode( (TiXmlNode*)&XmlElement );
				else
				{
					//if( pXUI_Wnd->SavePropertys( &XmlElement ) == false ) return false;
					TiXmlElement Attribute( "attribute" );
					if( pXUI_Wnd->save_file( &Attribute ) == false ) return false;
					XmlElement.InsertEndChild( Attribute );
				}

				pNode->InsertEndChild( XmlElement );
				++citer;
			}
			return true;
		}
开发者ID:siangzhang,项目名称:starworld,代码行数:30,代码来源:XUI_Window.cpp


示例2: save_window_ok_button_callback

si_t save_window_ok_button_callback(void* btn, void* msg)
{
    union message* m = (union message*)msg;
	switch(m->base.type)
	{
    case MESSAGE_TYPE_MOUSE_SINGLE_CLICK:
		if(0 == save_file(text_line_get_buf(save_text_line), text_line_get_buf(file_context_text_line)))
		{
			sprintf(log_label->text, "save successfully!");
		}
		else
		{
			sprintf(log_label->text, "failed to save file!");
		}
		application_del_window(save_window);
		sprintf(file_label->text, "%s", text_line_get_buf(save_text_line));
		save_window = NULL;
		save_text_line = NULL;
		break;
    default:
        button_default_callback(btn, msg);
        return 0;
        break;
	}
    label_repaint(log_label);
    label_show(log_label);
    return 0;
}
开发者ID:FangKuangKuang,项目名称:egui,代码行数:28,代码来源:editerbasic.c


示例3: write_file

int
write_file(char *file)
{
    int return_val = OK;

    if (ignore_prev == 1)
	/* if user wants to ignore previous version, we remove it *
	 * ( fcron daemon remove files no longer wanted before
	 *   adding new ones ) */
	remove_fcrontab(0);

    if ( file_base->cf_line_base == NULL ) {
	/* no entries */
	explain("%s's fcrontab contains no entries : removed.", user);
	remove_fcrontab(0);
    } 
    else {
	/* write the binary fcrontab on disk */
	snprintf(buf, sizeof(buf), "new.%s", user);
	if ( save_file(buf) != OK )
	    return_val = ERR;
    }

    /* copy original file to fcrontabs dir */
    snprintf(buf, sizeof(buf), "%s.orig", user);
    if ( copy(file, buf) == ERR )
	return_val = ERR;

    return return_val;
}
开发者ID:yangyan,项目名称:RV_XJTU_CS,代码行数:30,代码来源:fcrontab.c


示例4: target_cm0p_read

//-----------------------------------------------------------------------------
static void target_cm0p_read(char *name)
{
  uint32_t size = device->flash_size;
  uint32_t addr = device->flash_start;
  uint32_t offs = 0;
  uint8_t *buf;

  if (dap_read_word(DSU_CTRL_STATUS) & 0x00010000)
    error_exit("devices is locked, unable to read");

  buf = buf_alloc(device->flash_size);

  verbose("Reading...");

  while (size)
  {
    dap_read_block(addr, &buf[offs], device->row_size);

    addr += device->row_size;
    offs += device->row_size;
    size -= device->row_size;

    verbose(".");
  }

  save_file(name, buf, device->flash_size);

  buf_free(buf);

  verbose(" done.\n");
}
开发者ID:sabinoj,项目名称:edbg,代码行数:32,代码来源:target_cm0p.c


示例5: main

main ()
{
	load_file (IN_FILE);
	code_file ();
	save_file (OUT_FILE);
	free_mem ();
}
开发者ID:daemqn,项目名称:Atari_ST_Sources,代码行数:7,代码来源:TCODE.C


示例6: scramble

static int
scramble (const char *src, uint32_t sz, char *dst)
{
    unsigned char *ptr = NULL;
    FILE *fh;

    if ((fh = fopen (src, "rb")) == NULL)
        return -1;

    if ((ptr = (unsigned char *) malloc (sz)) == NULL)
        return -1;

    if (fread (ptr, 1, sz, fh) != sz)
        return -1;

    fclose (fh);

    if (!(fh == fopen (dst, "wb")))
        return -1;
    save_file (fh, ptr, sz);

    fclose (fh);

    free (ptr);
    return 0;
}
开发者ID:optixx,项目名称:quickdev16,代码行数:26,代码来源:dc.c


示例7: get_next_line

int		get_next_line(int const fd, char **line)
{
	static t_list	*file;
	unsigned int	index;
	char			*content;

	if (!line || fd < 0 || fd == 1)
		return (-1);
	if ((!file || fd == 0) && (file = ft_lstnew(NULL, 0)))
		if ((save_file(fd, &file)) < 1)
			return (-1);
	*line = "\0";
	while (file)
	{
		index = 0;
		content = file->content;
		while (content[index] && content[index] != '\n')
			index++;
		*line = ft_strjoin(*line, ft_strsub(content, 0, index));
		if (content[index] == '\n' && content[index + 1])
			return (file->content = &content[index + 1], 1);
		else if ((content[index] == '\n' && !content[index + 1]) || !file->next)
			return (file = file->next, 1);
		file = file->next;
	}
	return (0);
}
开发者ID:abellion,项目名称:FDF,代码行数:27,代码来源:get_next_line.c


示例8: e_book_backend_vcf_dispose

static void
e_book_backend_vcf_dispose (GObject *object)
{
	EBookBackendVCF *bvcf;

	bvcf = E_BOOK_BACKEND_VCF (object);

	if (bvcf->priv) {

		g_mutex_lock (bvcf->priv->mutex);

		if (bvcf->priv->flush_timeout_tag) {
			g_source_remove (bvcf->priv->flush_timeout_tag);
			bvcf->priv->flush_timeout_tag = 0;
		}

		if (bvcf->priv->dirty)
			save_file (bvcf);

		g_hash_table_destroy (bvcf->priv->contacts);
		g_list_foreach (bvcf->priv->contact_list, (GFunc)g_free, NULL);
		g_list_free (bvcf->priv->contact_list);

		g_free (bvcf->priv->filename);

		g_mutex_unlock (bvcf->priv->mutex);

		g_mutex_free (bvcf->priv->mutex);

		g_free (bvcf->priv);
		bvcf->priv = NULL;
	}

	G_OBJECT_CLASS (e_book_backend_vcf_parent_class)->dispose (object);
}
开发者ID:nobled,项目名称:evolution-data-server,代码行数:35,代码来源:e-book-backend-vcf.c


示例9: exists

void save_settings::save(error_code& ec) const
{
	// back-up current settings file as .bak before saving the new one
	std::string backup = m_settings_file + ".bak";
	bool has_settings = exists(m_settings_file);
	bool has_backup = exists(backup);

	if (has_settings && has_backup)
		remove(backup, ec);

	if (has_settings)
		rename(m_settings_file, backup, ec);

	ec.clear();

	entry sett;
	m_ses.save_state(sett);

	for (std::map<std::string, int>::const_iterator i = m_ints.begin()
		, end(m_ints.end()); i != end; ++i)
	{
		sett[i->first] = i->second;
	}

	for (std::map<std::string, std::string>::const_iterator i = m_strings.begin()
		, end(m_strings.end()); i != end; ++i)
	{
		sett[i->first] = i->second;
	}
	std::vector<char> buf;
	bencode(std::back_inserter(buf), sett);
	save_file(m_settings_file, buf, ec);
}
开发者ID:arvidn,项目名称:libtorrent-webui,代码行数:33,代码来源:save_settings.cpp


示例10: access

log::log(string filename=string("all.log"))
{
    int ret = access("log",0);
    if(ret == -1)

#ifdef WINDOWSCODE
        mkdir("log");
#else
        mkdir("log", 0777);
#endif

    if(m_fp==NULL)
    {
        //m_fp=fopen(filename.c_str(), "a");
        //日志文件打开的模式  对文件的大小是否变换起决定性的作用, a方式 一直会增大,

        if(access("all.log", 0) == 0)
            save_file();

        m_fp=fopen(filename.c_str(), "wb");
        if(m_fp==NULL)
        {
            printf("open file error \n");
            exit(-1);
        }
    }
}
开发者ID:greshem,项目名称:develop_wxwidgets,代码行数:27,代码来源:log.cpp


示例11: file_check_data

static void file_check_data(	struct file_info *file,
				int fd,
				struct write_info *w)
{
	size_t remains, block, i;
	off_t r;
	char buf[BUFFER_SIZE];

	srand(w->random_seed);
	for (r = 0; r < w->random_offset; ++r)
		rand();
	CHECK(lseek(fd, w->offset, SEEK_SET) != (off_t) -1);
	remains = w->size;
	while (remains) {
		if (remains > BUFFER_SIZE)
			block = BUFFER_SIZE;
		else
			block = remains;
		CHECK(read(fd, buf, block) == block);
		for (i = 0; i < block; ++i) {
			char c = (char) rand();
			if (buf[i] != c) {
				fprintf(stderr, "file_check_data failed at %u "
					"checking data at %u size %u\n",
					(unsigned) (w->size - remains + i),
					(unsigned) w->offset,
					(unsigned) w->size);
				file_info_display(file);
				save_file(fd, file);
			}
			CHECK(buf[i] == c);
		}
		remains -= block;
	}
}
开发者ID:OpenNoah,项目名称:mtd-utils,代码行数:35,代码来源:integck.c


示例12: file_check_hole

static void file_check_hole(	struct file_info *file,
				int fd, off_t offset,
				size_t size)
{
	size_t remains, block, i;
	char buf[BUFFER_SIZE];

	CHECK(lseek(fd, offset, SEEK_SET) != (off_t) -1);
	remains = size;
	while (remains) {
		if (remains > BUFFER_SIZE)
			block = BUFFER_SIZE;
		else
			block = remains;
		CHECK(read(fd, buf, block) == block);
		for (i = 0; i < block; ++i) {
			if (buf[i] != 0) {
				fprintf(stderr, "file_check_hole failed at %u "
					"checking hole at %u size %u\n",
					(unsigned) (size - remains + i),
					(unsigned) offset,
					(unsigned) size);
				file_info_display(file);
				save_file(fd, file);
			}
			CHECK(buf[i] == 0);
		}
		remains -= block;
	}
}
开发者ID:OpenNoah,项目名称:mtd-utils,代码行数:30,代码来源:integck.c


示例13: pce_shutdown

void pce_shutdown(void)
{
    if(save_bram) save_file("pce.brm", bram, 0x2000);
#ifdef DEBUG
    error("PC:%04X\n", h6280_get_pc());
#endif
}
开发者ID:ArtemioUrbina,项目名称:huc,代码行数:7,代码来源:pce.c


示例14: mlx_name

mlx_name()
{
	int nblocks,block;
	GLOBRECORD *blockptr[MAXNBLOCKS+1];
	long addr[32],leng[32];	/* oversized */

	/* load multi-block file containing block to be renamed */
	Dsetdrv(mlt_drive); dsetpath(mlt_path);
	if (!readdatafile(MLXNAMTITL,mlxfile,mlxpath,MLX_EXT,0)) return;
	mlt_drive= Dgetdrv(); Dgetpath(mlt_path,mlt_drive+1);
	mlx_mem= tempmem;

	/* choose block from it */
	nblocks= scan_blocks(heap[mlx_mem].start,blockptr);
	if (!nblocks) return;	/* can't happen? */
	block= select_block(BLOCK2NAM,nblocks,blockptr);
	if ( (block<0) || (block>=nblocks) ) return;

	/* edit the comment field in the selected block, and replace file
		without warning */
	if (_mlx_name(blockptr[block]->comment))
	{
		addr[0]= heap[mlx_mem].start;
		leng[0]= heap[mlx_mem].nbytes;
		save_file(mlxfile,mlxpath,-1,addr,leng);
	}

}	/* end mlx_name() */
开发者ID:daemqn,项目名称:Atari_ST_Sources,代码行数:28,代码来源:MULTI.C


示例15: save_file

void
GIFFManager::save_file(TArray<char> & data)
{
  GP<ByteStream> gstr=ByteStream::create();
  save_file(gstr);
  data=gstr->get_data();
}
开发者ID:371816210,项目名称:ebookdroid-1,代码行数:7,代码来源:GIFFManager.cpp


示例16: QDialog

//*******************************************************************
// QBtFileEditor                                         CONSTRUCTOR
//*******************************************************************
QBtFileEditor::QBtFileEditor( QWidget* const in_parent, const QString& in_path ) : QDialog( in_parent )
, path_    ( QString() )
, editor_  ( new QTextEdit )
, reload_  ( new QPushButton( tr( RELOAD ) ) )
, save_    ( new QPushButton( tr( SAVE   ) ) )
, cancel_  ( new QPushButton( tr( CANCEL ) ) )
{
   setWindowTitle( tr( CAPTION ) );

   path_ = QFile::symLinkTarget( in_path );
   if( path_.isEmpty() ) path_ = in_path;
   
   static const QString my_font = "Monospace,9,-1,5,50,0,0,0,0,0";
   QFont fnt;
   fnt.fromString( my_font );
   editor_->setFont( fnt );   

   QHBoxLayout* const btn_layout = new QHBoxLayout;
   btn_layout->addStretch();
   btn_layout->addWidget( reload_ );
   btn_layout->addWidget( save_   );
   btn_layout->addWidget( cancel_ );

   QVBoxLayout* const main_layout = new QVBoxLayout;
   main_layout->addWidget( editor_ );
   main_layout->addLayout( btn_layout );
   setLayout( main_layout );

   connect( reload_, SIGNAL( clicked() ), this, SLOT( reload_file() ) );
   connect( save_  , SIGNAL( clicked() ), this, SLOT( save_file  () ) );
   connect( cancel_, SIGNAL( clicked() ), this, SLOT( accept     () ) );

   cancel_->setDefault( true );
}
开发者ID:NasuTek,项目名称:NasuTek-Commander,代码行数:37,代码来源:QBtFileEditor.cpp


示例17: do_save_as

static void
do_save_as (GtkAction *action)
{
  GtkWidget *dialog;
  gint response;
  char *save_filename;
  
  dialog = gtk_file_chooser_dialog_new ("Select file",
					GTK_WINDOW (main_window),
					GTK_FILE_CHOOSER_ACTION_SAVE,
					GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
					GTK_STOCK_SAVE, GTK_RESPONSE_OK,
					NULL);
  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
  response = gtk_dialog_run (GTK_DIALOG (dialog));

  if (response == GTK_RESPONSE_OK)
    {
      save_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
      save_file (save_filename);
      g_free (save_filename);
    }
  
  gtk_widget_destroy (dialog);
}
开发者ID:Aridna,项目名称:gtk2,代码行数:25,代码来源:print-editor.c


示例18: switch

//********************************************************
void WordsEdit::closeEvent( QCloseEvent *e )
{
  
  if(changed){
      
    switch ( QMessageBox::warning( this, "WORDS.TOK edit",
                                   "Save changes to WORDS.TOK ?",
                                   "Yes",
                                   "No",
                                   "Cancel",
                                   0, 2) ) {
    case 0: // yes
      save_file() ;
        deinit();
        e->accept();

        //      else
        // e->ignore();
      break;
    case 1: // no
      deinit();
      e->accept();
      break;
    default: // cancel
      e->ignore();
      break;
    }    
  }
  else{
    deinit();
    e->accept();
  }

}
开发者ID:saintfrater,项目名称:qt-agi-studio,代码行数:35,代码来源:wordsedit.cpp


示例19: QString

void Top_Menu::save()
{
    if (window_->mode_flag_ == DRAW_2_CURVES && window_->input_menu_->choose_coloring_box_2_->currentIndex() == T_IMAGE
            && show_save_image_warning_)
    {
        QMessageBox message_box;
        message_box.setWindowTitle("Save...");
        message_box.setIcon(QMessageBox::Information);
        QString message = QString("Saving the image is not supported.");
        message_box.setText(message);
        message_box.setInformativeText("You may need to set an image again when you load the file.");
        message_box.setStandardButtons(QMessageBox::Ok);
        message_box.exec();

        show_save_image_warning_ = false;
    }


    if(last_loaded_file_.isEmpty())
    {
        save_as();
    }
    std::ofstream save_file(last_loaded_file_.toStdString().c_str(), std::ios::out | std::ios::trunc);
    window_->configuration_->update_parameters();
    window_->configuration_->write_in_file(save_file);
    save_file.close();
    return;
}
开发者ID:seub,项目名称:CirclePackings,代码行数:28,代码来源:top_menu.cpp


示例20: main

void main() {

	GOODS goods[MAX];
	int choice, sum;
	
	sum = read_file(goods);

	if (sum == 0) {

		printf ("Key in the goods information~********\n");
		getchar();
		sum = input (goods);

	}

	do {

		clrscr();

		printf ("\n\n		**********the managed system of supermarket***********");

		printf ("	1.Append the goods information	\n\n");
		printf ("	2.Modify the goods information	\n\n");
		printf ("	3.Delete the goods information	\n\n");
		printf ("	4.Print the informationof stock goods	\n\n");
		printf ("	5.Inquire the goods information	\n\n");
		printf ("	6.Count the goods information	\n\n");
		printf ("	7.Sort the goods information	\n\n");
		printf ("	0.Exit the system of goods information	\n\n");
		
		printf ("	Please choose that you want(0~7):");
		
		scanf ("%d", &choice);	

		switch (choice)	{

			case 1:append();
			       break;
			case 2:modify(goods, sum);
		       	       break;
			case 3:delete();
			       break;
			case 4:output(goods, sum);
			       break;
			case 5:inquire();
			       break;
			case 6:count();
			       break;
			case 7:sort(goods, sum);
			       break;
			case 0:break;

		}

	   }while (choice != 0);

	save_file(goods, sum);

}
开发者ID:niki-lafee,项目名称:dfh,代码行数:59,代码来源:supermarket.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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