您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ write_file函数代码示例

51自学网 2021-06-03 10:05:37
  C++
这篇教程C++ write_file函数代码示例写得很实用,希望能帮到您。

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

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

示例1: main

//.........这里部分代码省略.........	if (uboot_size <= 0) {		fprintf(stderr, "Invalid U-Boot Size %d/n", uboot_size);		close(devfd);		return -1;	}	uboot_size = (uboot_size + BLOCK_SIZE - 1) & ~BLOCK_SIZE;	verbose_printf("U-Boot Size %d/n", uboot_size);	/* Get first partition start address offset from Master Boot Record */	part1_offset = get_le32((uint8 *)&readbuf[PART1_LBA_OFFSET]);	verbose_printf("First partition starts at %d(%ld)/n", part1_offset,			(part1_offset * BLOCK_SIZE));	/* Add MBR + UBL Size + Uboot Size */	req_blocks = UBL_START_BLOCK + (ubl_size / BLOCK_SIZE) +		UBL_BLOCK_OFFSET + (uboot_size / BLOCK_SIZE) + 1;	printf("Required Blocks %d, Available Blocks %d/n", req_blocks,			part1_offset - 1);	/* Return if the card does not have enough space for writing */	if (req_blocks > part1_offset) {		fprintf(stderr, "Not enough space left for flashing "				"UBL and U-boot/n");		fprintf(stderr, "Make sure that the First Partition Starts "				"after %d sectors/n", req_blocks);		close(devfd);		return -1;	}	/* Generate UBL Signature */	rblp = (struct rbl_header *)ubl_signature;	memset(rblp, 0, sizeof(struct rbl_header));	rblp->magic_num = UBL_MAGIC_NUM;	rblp->entry_point = UBL_ENTRY_POINT;	rblp->num_blocks = ubl_size / BLOCK_SIZE;	rblp->start_block = UBL_START_BLOCK;	if (verbose > 1) {		printf("UBL Magic Number        : %08x/n", rblp->magic_num);		printf("UBL Entry Point         : %08x/n", rblp->entry_point);		printf("UBL Number of Blocks    : %08x/n", rblp->num_blocks);		printf("UBL Starting Block      : %08x/n", rblp->start_block);		printf("UBL Load Address        : %08x/n", rblp->load_address);	}	/* Write UBL Signature */	verbose_printf("Writing UBL Signature/n");	lseek(devfd, (BLOCK_SIZE * UBL_SIGN_START), SEEK_SET);	for (i = UBL_SIGN_START; i < (UBL_SIGN_COUNT + UBL_SIGN_START); i++) {		writelen = write(devfd, rblp, BLOCK_SIZE);		if (writelen < BLOCK_SIZE) {			close(devfd);			return -1;		}	}	/* Write UBL Binary */	verbose_printf("Writing UBL/n");	lseek(devfd, (BLOCK_SIZE * rblp->start_block), SEEK_SET);	write_file(devfd, ubl_name);	/* Generate U-boot signature */	rblp = (struct rbl_header *)uboot_signature;	memset(rblp, 0, sizeof(struct rbl_header));	rblp->magic_num = UBOOT_MAGIC_NUM;	rblp->entry_point = uboot_entry_point;	rblp->num_blocks = (uboot_size / BLOCK_SIZE) + 1;	rblp->start_block = UBL_START_BLOCK + (ubl_size / BLOCK_SIZE) +		UBL_BLOCK_OFFSET;	rblp->load_address = uboot_load_address;	if (verbose > 1) {		printf("U-Boot Magic Number     : %08x/n", rblp->magic_num);		printf("U-Boot Entry Point      : %08x/n", rblp->entry_point);		printf("U-Boot Number of Blocks : %08x/n", rblp->num_blocks);		printf("U-Boot Starting Block   : %08x/n", rblp->start_block);		printf("Load U-Boot Address     : %08x/n", rblp->load_address);	}	/* Write U-Boot Signature */	verbose_printf("Writing U-Boot Signature/n");	lseek(devfd, (BLOCK_SIZE * UBOOT_SIGN_START), SEEK_SET);	for (i = UBOOT_SIGN_START; i < (UBOOT_SIGN_COUNT + UBOOT_SIGN_START);			i++) {		writelen = write(devfd, rblp, BLOCK_SIZE);		if (writelen < BLOCK_SIZE) {			close(devfd);			return -1;		}	}	/* Write U-Boot File */	lseek(devfd, (BLOCK_SIZE * rblp->start_block), SEEK_SET);	verbose_printf("Writing U-Boot/n");	write_file(devfd, uboot_name);	printf("Done.../n");	close(devfd);	return 0;}
开发者ID:virt2real,项目名称:othersoft,代码行数:101,


示例2: main

int main(){    printf(        "Going to try to delete files using various techiques./n"        "Note that the MoveFileEx method will fail (see source why)/n"    );    write_file("abc.txt", "DeleteFile");    //    // delete the file using the well-known DeleteFile function    //    printf("DeleteFile: %s (0x%08x)/n", DeleteFile("abc.txt") ?        "SUCCESS" : "FAILURE", GetLastError());    write_file("abc.txt", "MoveFileEx");    //    // delete the file using MoveFileEx, note that a NULL destination filename    // is only supported when the MOVEFILE_DELAY_UNTIL_REBOOT flag is set.    // (so this call will actually fail..)    //    printf("MoveFileEx: %s (0x%08x)/n", MoveFileEx("abc.txt", NULL, 0) ?        "SUCCESS" : "FAILURE", GetLastError());    write_file("abc.txt", "ZwDeleteFile");    //    // delete the file using ZwDeleteFile    //    UNICODE_STRING dir_fname, file_fname;    OBJECT_ATTRIBUTES obj_dir, obj_file;    IO_STATUS_BLOCK io_dir;    HANDLE dir_handle;    *(FARPROC *) &pRtlInitUnicodeString = GetProcAddress(        GetModuleHandle("ntdll"), "RtlInitUnicodeString");    *(FARPROC *) &pZwDeleteFile = GetProcAddress(        GetModuleHandle("ntdll"), "ZwDeleteFile");    *(FARPROC *) &pZwCreateFile = GetProcAddress(        GetModuleHandle("ntdll"), "ZwCreateFile");    *(FARPROC *) &pZwSetInformationFile = GetProcAddress(        GetModuleHandle("ntdll"), "ZwSetInformationFile");    // prepend the path with "//??//"    wchar_t cur_dir[MAX_PATH] = L"//??//";    GetCurrentDirectoryW(MAX_PATH-4, cur_dir+4);    pRtlInitUnicodeString(&dir_fname, cur_dir);    pRtlInitUnicodeString(&file_fname, L"abc.txt");    InitializeObjectAttributes(&obj_dir, &dir_fname,        OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);    // open the directory    NTSTATUS ret = pZwCreateFile(&dir_handle, FILE_TRAVERSE, &obj_dir,        &io_dir, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OPEN,        FILE_DIRECTORY_FILE, NULL, 0);    if(NT_SUCCESS(ret)) {        InitializeObjectAttributes(&obj_file, &file_fname,            OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, dir_handle, NULL);        // delete the file        ret = pZwDeleteFile(&obj_file);        printf("ZwDeleteFile: %s (0x%08x)/n", NT_SUCCESS(ret) ?            "SUCCESS" : "FAILURE", ret);        CloseHandle(dir_handle);    }    else {        printf("ZwDeleteFile: FAILURE (0x%08x)/n", ret);    }    write_file("abc.txt", "ZwSetInformationFile");    //    // delete the file using ZwSetInformationFile    //    IO_STATUS_BLOCK io_file;    HANDLE file_handle;    // prepend the path with "//??//" and append "abc.txt"    wchar_t file_name[MAX_PATH] = L"//??//";    GetCurrentDirectoryW(MAX_PATH-4, file_name+4);    lstrcatW(file_name, L"//abc.txt");    pRtlInitUnicodeString(&file_fname, file_name);    InitializeObjectAttributes(&obj_file, &file_fname,        OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);    // open the file with DELETE access rights    ret = pZwCreateFile(&file_handle, DELETE, &obj_file, &io_file, NULL,        FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN, 0, NULL, 0);    if(NT_SUCCESS(ret)) {        BOOLEAN disp_info = TRUE;        ret = pZwSetInformationFile(file_handle, &io_file, &disp_info,//.........这里部分代码省略.........
开发者ID:ArchangelGabriel,项目名称:ifscs,代码行数:101,


示例3: do_write

int do_write(int nargs, char **args){    return write_file(args[1], args[2]);}
开发者ID:carl1961,项目名称:platform_system,代码行数:4,


示例4: run_assembly

//.........这里部分代码省略.........	//add the the input file's path to the include directories	include_dirs = list_prepend (include_dirs, strdup (temp_path));	printf ("Pass one... /n");	int first_pass_session = StartSPASMErrorSession();	run_first_pass ((char *) input_contents);	ReplayFatalSPASMErrorSession(first_pass_session);	EndSPASMErrorSession(first_pass_session);	//free include dirs when done	if ((mode & MODE_COMMANDLINE) == 0)	{		release_file_contents(input_contents);		input_contents = NULL;	}		list_free (include_dirs, true, NULL);	include_dirs = NULL;	//...and if there's output, run the second pass and write it to the output file	if (mode & MODE_SYMTABLE || mode & MODE_NORMAL || mode & MODE_LIST)	{		printf ("Pass two... /n");		int second_pass_session = StartSPASMErrorSession();		run_second_pass ();		ReplaySPASMErrorSession(second_pass_session);		EndSPASMErrorSession(second_pass_session);		if (mode & MODE_SYMTABLE) {			char* fileName = change_extension(output_filename, "lab");			write_labels (fileName);			free(fileName);		}		//run the output through the appropriate program export and write it to a file		if (mode & MODE_NORMAL && output_filename != NULL)		{			write_file (output_contents, out_ptr - output_contents, output_filename);		}		//write the listing file if necessary		if ((mode & MODE_LIST)) {			FILE *file;			char *name;			//get file name			name = change_extension (output_filename, "lst");			file = fopen (name, "wb");			if (!file) {				printf ("Couldn't open listing file '%s'", name);				free (name);				return EXIT_FATAL_ERROR;			}			free (name);						if (fwrite (listing_buf->start, 1, listing_offset, file) != listing_offset) {				puts ("Error writing to listing file");				fclose (file);				return EXIT_FATAL_ERROR;			}			fclose (file);			eb_free(listing_buf);			listing_buf = NULL;		}				//free the output buffer and all the names of input files		list_free(input_files, true, NULL);		input_files = NULL;	}	//if there's info to be dumped, do that	if (mode & MODE_CODE_COUNTER) {		fprintf (stdout, "Size: %u/nMin. execution time: %u/nMax. execution time: %u/n",		         stats_codesize, stats_mintime, stats_maxtime);	}		if (mode & MODE_STATS) {		fprintf(stdout, "Number of labels: %u/nNumber of defines: %u/nCode size: %u/nData size: %u/nTotal size: %u/n",		         get_num_labels (), get_num_defines (), stats_codesize, stats_datasize, stats_codesize + stats_datasize);	}	#ifdef _WIN32	_ftime(&time_end);#else	ftime(&time_end);#endif	int s_diff = (int) (time_end.time - time_start.time);	int ms_diff = time_end.millitm - time_start.millitm;	if (ms_diff < 0) {		ms_diff += 1000;		s_diff -= 1;	} else if (ms_diff > 1000) {		ms_diff -= 1000;		s_diff += 1;	}	printf("Assembly time: %0.3f seconds/n", (float) s_diff + ((float) ms_diff / 1000.0f));	return exit_code;}
开发者ID:jacobly0,项目名称:spasm-ng,代码行数:101,


示例5: _nc_write_entry

//.........这里部分代码省略.........    if (strlen(first_name) >= sizeof(filename) - (2 + LEAF_LEN))	_nc_warning("terminal name too long.");    _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename))		LEAF_FMT "/%s", first_name[0], first_name);    /*     * Has this primary name been written since the first call to     * write_entry()?  If so, the newer write will step on the older,     * so warn the user.     */    if (start_time > 0 &&	stat(filename, &statbuf) >= 0	&& statbuf.st_mtime >= start_time) {#if HAVE_LINK && !USE_SYMLINKS	/*	 * If the file has more than one link, the reason for the previous	 * write could be that the current primary name used to be an alias for	 * the previous entry.  In that case, unlink the file so that we will	 * not modify the previous entry as we write this one.	 */	if (statbuf.st_nlink > 1) {	    _nc_warning("name redefined.");	    unlink(filename);	} else {	    _nc_warning("name multiply defined.");	}#else	_nc_warning("name multiply defined.");#endif    }    check_writeable(first_name[0]);    write_file(filename, tp);    if (start_time == 0) {	if (stat(filename, &statbuf) < 0	    || (start_time = statbuf.st_mtime) == 0) {	    _nc_syserr_abort("error obtaining time from %s/%s",			     _nc_tic_dir(0), filename);	}    }    while (*other_names != '/0') {	ptr = other_names++;	while (*other_names != '|' && *other_names != '/0')	    other_names++;	if (*other_names != '/0')	    *(other_names++) = '/0';	if (strlen(ptr) > sizeof(linkname) - (2 + LEAF_LEN)) {	    _nc_warning("terminal alias %s too long.", ptr);	    continue;	}	if (strchr(ptr, '/') != 0) {	    _nc_warning("cannot link alias %s.", ptr);	    continue;	}	check_writeable(ptr[0]);	_nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname))		    LEAF_FMT "/%s", ptr[0], ptr);	if (strcmp(filename, linkname) == 0) {	    _nc_warning("self-synonym ignored");	} else if (stat(linkname, &statbuf) >= 0 &&
开发者ID:2asoft,项目名称:freebsd,代码行数:67,


示例6: main

main ( ){        int i, res;        char ch;        char input[30];        int nbytes;        uint64_t dev_size;        printf("Opening /dev/hv_cdev0 file/n");        fd = open64("/dev/hv_cdev0", O_RDWR);        if (fd == -1)        {                printf("Error in opening file /n");                return(-1);        }        while(1) {        	print_menu();        	/* read user input and get rid of CR */        	scanf ("%s%*c", &ch);        	printf("Your input = %c/n/n", ch);        	switch (ch) {        		case '1':            		read_file();                    break;                case '2':                	write_file();                    break;                case '3':                	printf("How many bytes to read? ");                	fgets(input, sizeof(input), stdin);                	printf("Your input = %d/n", atoi(input));                	break;                case '4':                	printf("How many bytes to write? ");                	fgets(input, sizeof(input), stdin);                	printf("Your input = %d/n", atoi(input));                	break;                	                case '6':                	fflush(NULL); 	                	mmap_file();                	break;                	                case '7':                	get_dev_size(&dev_size);                	printf("mmls size: %llu/n", dev_size);                	break;                	                case 'q':                	goto exit;                default:                    printf("/nWrong choice /n");                    break;        	}        } exit:        close(fd);        return 0;}
开发者ID:ssg10,项目名称:linux_char_driver_and_app,代码行数:67,


示例7: strcpy

//-------- Begin of function GameFile::save_game --------////// return : <int> 1 - saved successfully.//                0 - not saved.//int GameFile::save_game(const char* fileName){	char full_path[MAX_PATH+1];	File   file;	String errStr;	power.win_opened=1;				// to disable power.mouse_handler()	if( fileName )		strcpy( file_name, fileName );	int rc = 1;	if (!misc.path_cat(full_path, sys.dir_config, file_name, MAX_PATH))	{		rc = 0;		errStr = _("Path too long to the saved game");	}	if( rc )	{		rc = file.file_create(full_path, 0, 1); // 0=tell File don't handle error itself																   // 1=allow the writing size and the read size to be different		if( !rc )			errStr = _("Error creating saved game file.");	}	if( rc )	{		save_process();      // process game data before saving the game		rc = write_game_header(&file);    // write saved game header information		if( !rc )			errStr = _("Error creating saved game header.");		if( rc )		{			rc = write_file(&file);			if( !rc )				errStr = _("Error writing saved game data.");		}	}	file.file_close();	power.win_opened=0;	//------- when saving error ---------//	if( !rc )	{		remove( file_name );         // delete the file as it is not complete		#ifndef DEBUG			errStr = _("Insufficient disk space ! The game is not saved.");		// use this message for all types of error message in the release version		#endif		box.msg( errStr );	}	return rc;}
开发者ID:ArseniyShestakov,项目名称:7kaa,代码行数:69,


示例8: menu

//.........这里部分代码省略.........       option = strtok( tmpstr, terms );            Capitalise( option);       if( equal(option, "L") )       {  theclosure = menu_load( strtok( NULL, terms ), strtok( NULL, terms ));          if( ExternalclosureClosure( theclosure) == NULL ) failed = 1;       }       else if ( equal(option, "B") )       {  failed = menu_browse();       }       else if ( equal(option, "WPK") )       {  failed = menu_write( strtok( NULL, terms ),                               strtok( NULL, terms ), 1 );        }       else if ( equal(option, "WUP") )       {  failed = menu_write( strtok( NULL, terms ),                               strtok( NULL, terms ), 0 );        }       else if (equal(option, "UDTOUM"))       {  Transformer *udinst_uminst;          imgtable = ELLA_InitTable();          udinst_uminst=          Make_udinst_uminst( MakeNullTransformer( objtable, imgtable));          update_closure( Transform( ExternalclosureClosure( theclosure),                                      udinst_uminst));          objtable = imgtable;       }       else if (equal(option, "ETOV"))       {  Transformer *ella_vif;          imgtable = VIF_InitTable();          ella_vif = make_ella_vif( MakeNullTransformer( objtable, imgtable));          update_closure( Transform( ExternalclosureClosure( theclosure),                                     ella_vif));          objtable = imgtable;       }       else if (equal(option, "ETOL"))       {  Transformer *ella_layout;          imgtable = LAY_InitTable();          ella_layout =                    make_ella_layout( MakeNullTransformer( objtable, imgtable));          update_closure( Transform( ExternalclosureClosure( theclosure),                                     ella_layout));               objtable = imgtable;       }       else if (equal(option, "VTOL"))       {  Transformer *vif_layout;          imgtable = LAY_InitTable();          vif_layout =                    make_vif_layout( MakeNullTransformer( objtable, imgtable));          update_closure( Transform( ExternalclosureClosure( theclosure),                                     vif_layout));          objtable = imgtable;       }       else if (equal(option, "LP"))       {  menu_layout( stdout );          failed = 1; /* We have not really failed, but need to hold the screen                      */       }       else if (equal(option, "LW"))       {  failed = write_file( strtok( NULL, terms ));       }       else if (equal(option, "Q"))       {  readoption = 0;          alwaysstop = 0;       }       else if ( equal(option, "IDS") )       {  print_idstable();          failed = 1; /* We have not really failed, but need to hold the screen                      */       }       else if ( equal(option, "HIDDEN") )       {  showhidden = 1 - showhidden;       }       else if ( equal(option, "PAUSE") )       {  alwaysstop = 1 - alwaysstop;       }       else if ( equal(option, "DIAG") )       {  tmpstr = strtok( NULL, terms );          if( tmpstr == NULL )          {  assemdiagfile = stdout;             alwaysstop = 1;          }          else          {  assemdiagfile = fopen( tmpstr, "w" );          }       }       else       {  printf( "Option %s not recognised./n", option );          failed = 1;       }       if( failed || alwaysstop )       {  prompt( "Press RETURN to continue > ", buffer );       }    }}
开发者ID:NevilleDNZ,项目名称:ella2000,代码行数:101,


示例9: cppath

intcppath(int a_ctrl, char *a_srcPath, char *a_dstPath, mode_t a_mode){	char		*linknam = (char *)NULL;	int		dstFd;	int		len;	int		srcFd;	long		status;	struct stat	srcStatbuf;	struct utimbuf	times;	/* entry debugging info */	echoDebug(DBG_CPPATH_ENTRY, a_ctrl, a_mode, a_srcPath, a_dstPath);	/* open source file for reading */	srcFd = open(a_srcPath, O_RDONLY);	if (srcFd < 0) {		progerr(ERR_OPEN_READ, a_srcPath,				errno, strerror(errno));		return (1);	}	/* obtain file status of source file */	if (fstat(srcFd, &srcStatbuf) != 0) {		progerr(ERR_FSTAT, srcFd, a_srcPath, errno, strerror(errno));		(void) close(srcFd);		return (1);	}	/*	 * Determine the permissions mode for the destination:	 * - if MODE_SET is specified:	 * --> use a_mode (do not mask off any portion)	 * --> If a_mode is unknown (? in the pkgmap), then the file gets	 * --> installed with the default 0644 mode	 * - if MODE_SRC is specified:	 * --> use the mode of the source (srcStatbuf.st_mode) but mask off all	 * --> non-access mode bits (remove SET?UID bits)	 * - otherwise:	 * --> use 0666	 */	if (a_ctrl & MODE_SET) {		mode_t	usemode;		usemode = (a_mode ^ BADMODE) ? a_mode : 0644;		if (a_mode != usemode && usemode == 0644) {			logerr(WRN_DEF_MODE, a_dstPath);			a_mode = usemode;		}	} else if (a_ctrl & MODE_SRC) {		a_mode = (srcStatbuf.st_mode & S_IAMB);	} else {		a_mode = 0666;	}	/*	 * Get fd of newly created destination file or, if this	 * is an overwrite,  a temporary file (linknam).	 */	dstFd = write_file(&linknam, a_ctrl, a_mode, a_dstPath);	if (dstFd < 0) {		(void) close(srcFd);		return (1);	}	/*	 * source and target files are open: copy data	 */	status = copyFile(srcFd, dstFd, a_srcPath, a_dstPath, &srcStatbuf, 0);	(void) close(srcFd);	(void) close(dstFd);	if (status != 0) {		progerr(ERR_INPUT, a_srcPath, errno, strerror(errno));		if (linknam) {			(void) remove(linknam);		}		return (1);	}	/*	 * If this is an overwrite, rename temp over original	 */	if ((linknam != (char *)NULL) && (rename(linknam, a_dstPath) != 0)) {		FILE	*logfp = (FILE *)NULL;		char	busylog[PATH_MAX];		/* output log message if busy else program error */		if (errno == ETXTBSY) {			logerr(MSG_PROCMV, linknam);		} else {//.........这里部分代码省略.........
开发者ID:belenix,项目名称:belenixold,代码行数:101,


示例10: printf

void *thread_carol(void *threadid){   int i;   time_t now;   printf("Thread Handling Carol Machines Created/n");   while(1){	sleep(20);	//printf("thread sleep/n");for(i = 0; i < 9; i++){				// if we dont want to test this device we jump to the next one		if(test_carol[i] != 1){			continue;		}		if(carol_reboot_count[i]>10){			test_carol[i]=0;			write_file("Tired of rebooting carol ",i);		}		time(&now);		if(carol[i] != NULL){			//printf("carol[%d] != NULL/n", i);			if(difftime(now, carol[i]) > MAX_TIME){				carol_reboot_count[i]++;				printf("/n/n/e[31mreboot carol%d/n",i);				printf("/e[0m");				write_file("Reboot carol", i);				if(i == 0){ //carolxeon1					system(CAROLXEON1_SW_OFF);					sleep(20);					system(CAROLXEON1_SW_ON);				}				if(i == 1){ //carolxeon2					system(CAROLXEON2_SW_OFF);					sleep(20);					system(CAROLXEON2_SW_ON);				}				if(i == 2){ //carolk20					system(CAROLK20_SW_OFF);					sleep(20);					system(CAROLK20_SW_ON);				}				if(i == 3){ //carolk40					system(CAROLK40_SW_OFF);					sleep(20);					system(CAROLK40_SW_ON);				}				if(i == 4){ //carolapu1					system(CAROLAPU1_SW_OFF);					sleep(20);					system(CAROLAPU1_SW_ON);				}				if(i == 5){ //carolapu2					system(CAROLAPU2_SW_OFF);					sleep(20);					system(CAROLAPU2_SW_ON);				}				if(i == 6){ //carolk1a					system(CAROLK1A_SW_OFF);					system(FPGA_SW_OFF);					sleep(20);					system(CAROLK1A_SW_ON);					system(FPGA_SW_ON);				}				if(i == 7){ //carolk1b					system(CAROLK1B_SW_OFF);					system(FPGA_SW_OFF);					sleep(20);					system(CAROLK1B_SW_ON);					system(FPGA_SW_ON);				}				if(i == 8){ //carolk1c					system(CAROLK1C_SW_OFF);					system(FPGA_SW_OFF);					sleep(20);					system(CAROLK1C_SW_ON);					system(FPGA_SW_ON);				}/*				if(i == 0){//carol1					system(CAROL1_SW_OFF);					sleep(20);					system(CAROL1_SW_ON);				}				if(i == 1){//carol3					system(CAROL3_SW_OFF);					sleep(20);					system(CAROL3_SW_ON);				}				if(i == 2){//carolAPU1					system(CAROLAPU1_SW_OFF);					sleep(20);					system(CAROLAPU1_SW_ON);				}*/				carol[i] = NULL;			}//.........这里部分代码省略.........
开发者ID:dagoliveira,项目名称:radiation-benchmarks,代码行数:101,


示例11: reload

//.........这里部分代码省略.........                    free(forwardzone);                    forwardzone = g->str_concat(tmphosts, forwardhosts);                    free(tmphosts);                }                else {                    g->str_replace(&forwardzone, "%h", forwardhosts);                }                // Add hosts to reverse-zone file                if (reversematch) {                    // Add existing domain content                    char *tmphosts = strdup(reversezone);                    g->str_replace(&tmphosts, "%h", "");                    free(reversezone);                    reversezone = g->str_concat(tmphosts, reversehosts);                    free(tmphosts);                }                else {                    g->str_replace(&reversezone, "%h", reversehosts);                }                free(forwardhosts);                free(reversehosts);                g->str_replace(&forwardzone, "%d", name);                g->str_replace(&reversezone, "%d", name);                snprintf(serial, 12, "%d", (int) time(NULL));                g->str_replace(&forwardzone, "%s", serial);                g->str_replace(&reversezone, "%s", serial);                g->str_replace(&forwardzone, "%c", netpart);                g->str_replace(&reversezone, "%c", netpart);                g->str_replace(&forwardzone, "%v", dnsserv ? (dnsserv) : ((char*) "127.0.0.1"));                g->str_replace(&reversezone, "%v", dnsserv ? (dnsserv) : ((char*) "127.0.0.1"));                // Set output files paths                finfile = dns->fzones;                rinfile = dns->rzones;                if (finfile[strlen(finfile) - 1] != '/')                    ftmpfile = g->str_concat(finfile, "/");                else                    ftmpfile = finfile;                if (rinfile[strlen(rinfile) - 1] != '/')                    rtmpfile = g->str_concat(rinfile, "/");                else                    rtmpfile = rinfile;                finfile = g->str_concat(ftmpfile, name);                rinfile = g->str_concat(rtmpfile, netpart);                // Write to output files                if (write_file(finfile, forwardzone) < 0) {                    syslog(LOG_WARNING, "[%s/dns] Unable to open output forward zone file '%s' for domain '%s', skipping forward zone for this domain.", dns->base.instance, finfile, name);                }                else if (!domainmatch) {                    char *zone, *tmpconf;                    zone = strdup(dns->confforward);                    g->str_replace(&zone, "%n", name);                    g->str_replace(&zone, "%c", netpart);                    g->str_replace(&zone, "%i", inet_ntoa(network));                    tmpconf = strdup(configentries);                    free(configentries);                    configentries = g->str_concat(tmpconf, zone);                    free(tmpconf);                    free(zone);                }                if (write_file(rinfile, reversezone) < 0)                {                    syslog(LOG_WARNING, "[%s/dns] Unable to open output reverse zone file '%s' for domain '%s', skipping reverse zone for this domain.", dns->base.instance, rinfile, name);                }                else if (!reversematch) {                    char *zone, *tmpconf;                    zone = strdup(dns->confreverse);                    g->str_replace(&zone, "%n", name);                    g->str_replace(&zone, "%c", netpart);                    // Don't support %i here, it will break bind config if you have                    // many networks with small mask that are subclasses of bigger one                    // e.g. 192.168.0.0/27 and 192.168.0.32/27                    // g->str_replace(&zone, "%i", inet_ntoa(network));                    g->str_replace(&zone, "%i", netpart);                    tmpconf = strdup(configentries);                    free(configentries);                    configentries = g->str_concat(tmpconf, zone);                    free(tmpconf);                    free(zone);                }                free(rtmpfile);                free(ftmpfile);                free(finfile);                free(rinfile);                free(forwardzone);                free(reversezone);            }
开发者ID:Bamby4a,项目名称:lms,代码行数:101,


示例12: main

//.........这里部分代码省略.........		}		switch(c) {			case 'a':				printf("option a with value of '%s'/n", optarg);				alphabet = file_to_string(optarg);				break;			case 'h':				print_man(TRUE);				return 0;				break;			case 's':				printf("option c with value of '%s'/n", optarg);				unknown_char = TRUE;				break;			case 'k':				printf("option d with value '%s'/n", optarg);				clef = file_to_string(optarg);				break;			default:				printf("?? getopt returned character code 0%o ??/n", c);				return 1;				break;		}	}	/*test args*/	switch(argc - optind) {		case 0:			/*in no argument read tab from keyboard*/			printf("pas d'argument entrer une chaine/n");			tab = calloc(100, sizeof(char));			fgets(tab, 99, stdin);			break;		case 1:			/* if one argument then read file and put it in tab*/			printf("arg 1 %s/n", argv[optind]);			tab = file_to_string(argv[optind]);			printf("tableau lue dans %s = %s/n", argv[optind], tab);			break;		case 2:			/*if 2 argumpent read file an put it in tab then set casetow to true*/			printf("arg2 %s/n", argv[optind - 1]);			casetwo = TRUE;			tab     = file_to_string(argv[optind]);			break;		default:			print_man(TRUE);			return 1;			break;	}	if(unknown_char == TRUE) {		/* remove uknow char if -s */		printf("remove unknown char/n");		rm_unknown_char(tab, alphabet);	}	tailletab  = strlen(tab);	tailleclef = strlen(clef);	taillalpha = strlen(alphabet);	itab       = malloc(tailletab * sizeof(int));	iclef      = malloc(tailleclef * sizeof(int));	printf("taille clef %d/n", tailleclef);	/*convert tab and key to int tab*/	string_to_int(tab, alphabet, itab);	string_to_int(clef, alphabet, iclef);	/*test invalid char in the key*/	testclef(iclef, tailleclef);	/*decod tab with the key, minus done with a pointer to the fuction*/	codclef(iclef, itab, tailletab, tailleclef, taillalpha, &addition);	/*convert the final int tab to a char tab*/	int_to_alpha(itab, tab, alphabet, tailletab);	/*if a dest file have been specified write the result into the file elese print the result */	if(casetwo == FALSE) {		printf("message final: %s/n", tab);	} else {		/*argv[optind+1] = file name*/		printf("ecriture de %s dans %s/n", tab, argv[optind + 1]);		write_file(argv[optind + 1], tab);	}	/*free all alocations*/	free(itab);	free(iclef);	free(tab);	return 0;}
开发者ID:berln,项目名称:vigenere,代码行数:101,


示例13: write_file

 inline void write_file(     const std::string& path,     const std::vector<unsigned char>& src) {     write_file(path, src.data(), src.size()); }
开发者ID:egor-tensin,项目名称:aes-tools,代码行数:6,


示例14: GetReplyFromJJ

void GetReplyFromJJ(char *InputText, int nMode, JJGui *jibber_ui){	static char szUserInput[512], szLastInput[ 512 ];	char *cPtr, szSeps[]=" /n";	int  i, nResponse, nKeyWordGroup = 0, nTailOffset = 0, nCommand = (-1);	// take a working copy of the string	strcpy(szUserInput, InputText );	// get the first word of the user input	cPtr = strtok(InputText, szSeps);	if (cPtr != NULL) {		// see if the first word is in the list of known commands		for (i=0; dCommands[i].Command != NULL; i++) {			// check abbreviations and full command names			if ((strcmp(dCommands[i].Abbrev, cPtr) == 0 ) || (strcmp(dCommands[i].Command, cPtr) == 0 )) {				// a command has been found - get its number				nCommand = dCommands[i].nCommand;				break;			}		}		// according to the number of the found command, do something		if ( nCommand >= 0 ) {			switch (nCommand) {				// is it a command string?				case COMMAND_TRON:					// turn on the system trace function					bShow = true;					AppendText(jibber_ui, DIR_SYSTEM, "Process trace ON");					break;				case COMMAND_TROFF:					// turn off the system trace function					bShow = false;					AppendText(jibber_ui, DIR_SYSTEM, "Process trace OFF");					break;				case COMMAND_SAVE:					// save the conversation to a file					write_file(jibber_ui);					break;				case COMMAND_TOPICS:					// show the topics used so far in the current conversation					DoListWalk(jibber_ui);					break;				case COMMAND_QUIT:				case COMMAND_EXIT:					// leave the program					gtk_widget_destroy(jibber_ui->window);					break;				case COMMAND_HELP:				case COMMAND_ABOUT:					// display a help text					AppendText(jibber_ui, DIR_SYSTEM, "Jibber Jabber %s :: Compiled on %s at %s.", JJ_VERSION, __DATE__, __TIME__);					AppendText(jibber_ui, DIR_BLANK, "" );					for (i=0; dCommands[i].Command != NULL; i++)							AppendText(jibber_ui, DIR_SYSTEM, "%-10s - %s", dCommands[i].Help1, dCommands[i].Help2);					AppendText(jibber_ui, DIR_BLANK, "" );					break;				// unknown command - do nothing				default : break;			}			// we have executed a command, no further processing required			return;		}	}	if (nMode == NORMAL_MODE)			AppendText(jibber_ui, DIR_IN, szUserInput);	// force user input to uppercase	SetToUppercase( szUserInput );	// no user entry - pick a null input response	if ( strlen( szUserInput ) == 0 )			nKeyWordGroup = GetGroupFromTriggerPhrase("JJNULLINPUT", jibber_ui);	// same user input as last time - pick a repeat response	else if ( strcmp( szUserInput, szLastInput ) == 0 )			nKeyWordGroup = GetGroupFromTriggerPhrase("JJREPEATEDINPUT", jibber_ui);	// check it for keywords	else {		// take a copy for next time		strcpy(szLastInput, szUserInput);		// determine the keyword group from the content of the user entry		nKeyWordGroup = GetKeyWordGroup( szUserInput, &nTailOffset, jibber_ui );//.........这里部分代码省略.........
开发者ID:TheGurkha,项目名称:Jibber,代码行数:101,


示例15: sha1_hash

void config_cache::read_cache(const std::string& file_path, config& cfg){	static const std::string extension = ".gz";	std::stringstream defines_string;	defines_string << file_path;	bool is_valid = true;	for(const preproc_map::value_type& d : defines_map_) {		//		// Only WESNOTH_VERSION is allowed to be non-empty.		//		if((!d.second.value.empty() || !d.second.arguments.empty()) &&		   d.first != "WESNOTH_VERSION")		{			is_valid = false;			ERR_CACHE << "Invalid preprocessor define: " << d.first << '/n';			break;		}		defines_string << " " << d.first;	}	// Do cache check only if define map is valid and	// caching is allowed.	const std::string& cache_path = filesystem::get_cache_dir();	if(is_valid && !cache_path.empty()) {		// Use a hash for a shorter display of the defines.		const std::string fname = cache_path + "/" +								  cache_file_prefix_ +								  sha1_hash(defines_string.str()).display();		const std::string fname_checksum = fname + ".checksum" + extension;		filesystem::file_tree_checksum dir_checksum;		if(!force_valid_cache_ && !fake_invalid_cache_) {			try {				if(filesystem::file_exists(fname_checksum)) {					config checksum_cfg;					DBG_CACHE << "Reading checksum: " << fname_checksum << "/n";					read_file(fname_checksum, checksum_cfg);					dir_checksum = filesystem::file_tree_checksum(checksum_cfg);				}			} catch(config::error&) {				ERR_CACHE << "cache checksum is corrupt" << std::endl;			} catch(filesystem::io_exception&) {				ERR_CACHE << "error reading cache checksum" << std::endl;			}		}		if(force_valid_cache_) {			LOG_CACHE << "skipping cache validation (forced)/n";		}		if(filesystem::file_exists(fname + extension) && (force_valid_cache_ || (dir_checksum == filesystem::data_tree_checksum()))) {			LOG_CACHE << "found valid cache at '" << fname << extension << "' with defines_map " << defines_string.str() << "/n";			log_scope("read cache");			try {				read_file(fname + extension,cfg);				const std::string define_file = fname + ".define" + extension;				if(filesystem::file_exists(define_file)) {					config_cache_transaction::instance().add_define_file(define_file);				}				return;			} catch(config::error& e) {				ERR_CACHE << "cache " << fname << extension << " is corrupt. Loading from files: "<< e.message << std::endl;			} catch(filesystem::io_exception&) {				ERR_CACHE << "error reading cache " << fname << extension << ". Loading from files" << std::endl;			} catch (boost::iostreams::gzip_error& e) {				//read_file -> ... -> read_gz can throw this exception.				ERR_CACHE << "cache " << fname << extension << " is corrupt. Error code: " << e.error() << std::endl;			}		}		LOG_CACHE << "no valid cache found. Writing cache to '" << fname << extension << " with defines_map "<< defines_string.str() << "'/n";		// Now we need queued defines so read them to memory		read_defines_queue();		preproc_map copy_map(make_copy_map());		read_configs(file_path, cfg, copy_map);		add_defines_map_diff(copy_map);		try {			write_file(fname + extension, cfg);			write_file(fname + ".define" + extension, copy_map);			config checksum_cfg;			filesystem::data_tree_checksum().write(checksum_cfg);			write_file(fname_checksum, checksum_cfg);		} catch(filesystem::io_exception&) {//.........这里部分代码省略.........
开发者ID:Wedge009,项目名称:wesnoth,代码行数:101,


示例16: run_dir_diff

//.........这里部分代码省略.........                    }                } else {                    struct stat st;                    if (stat(wtdir.buf, &st))                        st.st_mode = 0644;                    if (copy_file(rdir.buf, wtdir.buf,                                  st.st_mode)) {                        ret = error("could not copy '%s' to '%s'", wtdir.buf, rdir.buf);                        goto finish;                    }                }            }        }    }    if (finish_command(&child)) {        ret = error("error occurred running diff --raw");        goto finish;    }    if (!i)        return 0;    /*     * Changes to submodules require special treatment.This loop writes a     * temporary file to both the left and right directories to show the     * change in the recorded SHA1 for the submodule.     */    hashmap_iter_init(&submodules, &iter);    while ((entry = hashmap_iter_next(&iter))) {        if (*entry->left) {            add_path(&ldir, ldir_len, entry->path);            ensure_leading_directories(ldir.buf);            write_file(ldir.buf, "%s", entry->left);        }        if (*entry->right) {            add_path(&rdir, rdir_len, entry->path);            ensure_leading_directories(rdir.buf);            write_file(rdir.buf, "%s", entry->right);        }    }    /*     * Symbolic links require special treatment.The standard "git diff"     * shows only the link itself, not the contents of the link target.     * This loop replicates that behavior.     */    hashmap_iter_init(&symlinks2, &iter);    while ((entry = hashmap_iter_next(&iter))) {        if (*entry->left) {            add_path(&ldir, ldir_len, entry->path);            ensure_leading_directories(ldir.buf);            write_file(ldir.buf, "%s", entry->left);        }        if (*entry->right) {            add_path(&rdir, rdir_len, entry->path);            ensure_leading_directories(rdir.buf);            write_file(rdir.buf, "%s", entry->right);        }    }    strbuf_release(&buf);    strbuf_setlen(&ldir, ldir_len);    helper_argv[1] = ldir.buf;    strbuf_setlen(&rdir, rdir_len);
开发者ID:dscho,项目名称:git,代码行数:67,


示例17: WriteTextLine

unsigned char WriteTextLine(unsigned int fhandle, char* buff) {  unsigned int len = strlen((char const*)buff);  write_file( fhandle, len, (char*)buff );  return write_file( fhandle, 2, (char*)CRLF );}
开发者ID:ferdok9,项目名称:GPSxc.X,代码行数:6,


示例18: tftp_send

//.........这里部分代码省略.........				 */				*block = 0;			} else {				*block = atoi(options[OPT_ROLLOVER].o_request);			}			ts->rollovers++;		}		gettimeofday(&(ts->tstop), NULL);	} while (size == segsize);abort:	return;}/* * Receive a file via the TFTP data session. * * - It could be that the first block has already arrived while *   trying to figure out if we were receiving options or not. In *   that case it is passed to this function. */voidtftp_receive(int peer, uint16_t *block, struct tftp_stats *ts,    struct tftphdr *firstblock, size_t fb_size){	struct tftphdr *rp;	uint16_t oldblock;	int n_data, n_ack, writesize, i, retry;	char recvbuffer[MAXPKTSIZE];	ts->amount = 0;	if (firstblock != NULL) {		writesize = write_file(firstblock->th_data, fb_size);		ts->amount += writesize;		for (i = 0; ; i++) {			n_ack = send_ack(peer, *block);			if (n_ack > 0) {				if (i == maxtimeouts) {					tftp_log(LOG_ERR,					    "Cannot send ACK packet #%d, "					    "giving up", *block);					return;				}				tftp_log(LOG_ERR,				    "Cannot send ACK packet #%d, trying again",				    *block);				continue;			}			break;		}		if (fb_size != segsize) {			gettimeofday(&(ts->tstop), NULL);			return;		}	}	rp = (struct tftphdr *)recvbuffer;	do {		oldblock = *block;		(*block)++;		if (oldblock > *block) {			if (options[OPT_ROLLOVER].o_request == NULL) {				/*
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:67,


示例19: main

//.........这里部分代码省略.........            getcwd(file_dir,1000);            strcat(file_dir,"/c_2.out");            file4=fopen(file_dir,"w");        }    }    else{       getcwd(file_dir,1000);        strcat(file_dir,"/c_1.out");        file3=fopen(file_dir,"w");        getcwd(file_dir,1000);        strcat(file_dir,"/c_2.out");        file4=fopen(file_dir,"w");    }    if(!file1 || !file2){        printf("Error in input files./n");        exit(0);    }    //read file 1    read_file1(file1);    //read file 2    read_file2(file2);    // check for multiplication condition    if(m1!=n2){        printf("m1 does not equal n2, can not do multiplication./n");        exit(0);    }    //allocate matrix3 and matrix4    matrix_allocate(&matrix3,n1,m2);    //method 1    int i,j;    pthread_t threads[n1][m2];    clock_t start=clock();    int flag1=1,flag2=1;    for(i=0;i<n1;i++){        int return_code= pthread_create(&threads[i][0],NULL,method1,(void *)i);        if(return_code){            //error occured creating thread            flag1=0;            break;        }    }    //join threads to continue with method2    int k;    for(k=0;k<i;k++){        pthread_join(threads[k][0],NULL);    }    //output1    if(flag1){        clock_t mthd1=clock();        printf("Method 1/n");        printf("Number of threads = %d/n",n1);        printf("Execution time = %lf milliseconds/n",(double) (mthd1-start)/CLOCKS_PER_SEC*1000.0);        write_file(file3);    }    else        printf("Error occured in method 1./n");    //initialize matrix3    for(i=0;i<n1;i++){        for(j=0;j<m2;j++)            matrix3[i][j]=0;    }    //method 2    clock_t start2 = clock();    for(i=0;i<n1;i++){        for(j=0;j<m2;j++){            int return_code= pthread_create(&threads[i][j],NULL,method2,(void *)(i*m2+j));            if(return_code){                flag2=0;                break;            }        }    }    int w;    for(w=0;w<i;w++){        for(k=0;k<j;k++){            pthread_join(threads[w][k],NULL);        }    }    //output 2    if(flag2){        clock_t mthd2=clock();        printf("Method 2/n");        printf("Number of threads = %d/n",n1*m2);        printf("Execution time = %lf milliseconds/n",(double)(mthd2-start2)/CLOCKS_PER_SEC*1000.0);        write_file(file4);    }    else        printf("Error occured in method 2./n");    //close files    fclose(file1);    fclose(file2);    fclose(file3);    fclose(file4);    return 0;}
开发者ID:fathallah94,项目名称:Academic-Projects,代码行数:101,


示例20: write_archive

/* * Write user-specified files/dirs to opened archive. */static voidwrite_archive(struct archive *a, struct bsdtar *bsdtar){	const char *arg;	struct archive_entry *entry, *sparse_entry;	/* Choose a suitable copy buffer size */	bsdtar->buff_size = 64 * 1024;	while (bsdtar->buff_size < (size_t)bsdtar->bytes_per_block)	  bsdtar->buff_size *= 2;	/* Try to compensate for space we'll lose to alignment. */	bsdtar->buff_size += 16 * 1024;	/* Allocate a buffer for file data. */	if ((bsdtar->buff = malloc(bsdtar->buff_size)) == NULL)		lafe_errc(1, 0, "cannot allocate memory");	if ((bsdtar->resolver = archive_entry_linkresolver_new()) == NULL)		lafe_errc(1, 0, "cannot create link resolver");	archive_entry_linkresolver_set_strategy(bsdtar->resolver,	    archive_format(a));	if ((bsdtar->diskreader = archive_read_disk_new()) == NULL)		lafe_errc(1, 0, "Cannot create read_disk object");	archive_read_disk_set_standard_lookup(bsdtar->diskreader);	if (bsdtar->names_from_file != NULL)		archive_names_from_file(bsdtar, a);	while (*bsdtar->argv) {		arg = *bsdtar->argv;		if (arg[0] == '-' && arg[1] == 'C') {			arg += 2;			if (*arg == '/0') {				bsdtar->argv++;				arg = *bsdtar->argv;				if (arg == NULL) {					lafe_warnc(0, "%s",					    "Missing argument for -C");					bsdtar->return_value = 1;					goto cleanup;				}				if (*arg == '/0') {					lafe_warnc(0,					    "Meaningless argument for -C: ''");					bsdtar->return_value = 1;					goto cleanup;				}			}			set_chdir(bsdtar, arg);		} else {			if (*arg != '/' && (arg[0] != '@' || arg[1] != '/'))				do_chdir(bsdtar); /* Handle a deferred -C */			if (*arg == '@') {				if (append_archive_filename(bsdtar, a,				    arg + 1) != 0)					break;			} else				write_hierarchy(bsdtar, a, arg);		}		bsdtar->argv++;	}	entry = NULL;	archive_entry_linkify(bsdtar->resolver, &entry, &sparse_entry);	while (entry != NULL) {		write_file(bsdtar, a, entry);		archive_entry_free(entry);		entry = NULL;		archive_entry_linkify(bsdtar->resolver, &entry, &sparse_entry);	}	if (archive_write_close(a)) {		lafe_warnc(0, "%s", archive_error_string(a));		bsdtar->return_value = 1;	}cleanup:	/* Free file data buffer. */	free(bsdtar->buff);	archive_entry_linkresolver_free(bsdtar->resolver);	bsdtar->resolver = NULL;	archive_read_free(bsdtar->diskreader);	bsdtar->diskreader = NULL;	if (bsdtar->option_totals) {		fprintf(stderr, "Total bytes written: %s/n",		    tar_i64toa(archive_position_compressed(a)));	}	archive_write_free(a);}
开发者ID:kamilWLca,项目名称:brix,代码行数:94,


示例21: CREATE_CPP_CODE_SAVED_DESIGNS

//.........这里部分代码省略.........        int tasarim_sayisi = 0;        while ( s_query.NEXT() EQ true ) {            if ( tasarim_sayisi NE 0 OR degiskenler_eklendi EQ true) {                degiskenler_code_str.append(",/n");            }            degiskenler_code_str.append("/t{ ");            degiskenler_code_str.append(QString ("/"%1/",/"%2/",/"%3/",/"%4/",%5,"                                                 "/"%6/",/"%7/",/"%8/",/"%9/",/"%10/","                                                 "%11, %12, %13, /"%14/", %15, %16, %17, %18, %19, %20")                                        .arg(s_query.VALUE("degisken_id").toString())                                        .arg(s_query.VALUE("font_size").toString())                                        .arg(s_query.VALUE("align").toString())                                        .arg(s_query.VALUE("is_visible_variable").toString())                                        .arg(s_query.VALUE("grup_enum").toString())                                        .arg(s_query.VALUE("size_vertical").toString())                                        .arg(s_query.VALUE("size_horizontal").toString())                                        .arg(s_query.VALUE("pos_x").toString())                                        .arg(s_query.VALUE("pos_y").toString())                                        .arg(s_query.VALUE("text").toString())                                        .arg(QVariant(eklenecek_belge_sayisi).toString())                                        .arg(s_query.VALUE("monospace_mi").toString())                                        .arg(s_query.VALUE("text_size").toString())                                        .arg(s_query.VALUE("font_family").toString())                                        .arg(s_query.VALUE("is_bold").toInt())                                        .arg(s_query.VALUE("is_under_line").toInt())                                        .arg(s_query.VALUE("is_italic").toInt())                                        .arg(s_query.VALUE("is_strikeout").toInt())                                        .arg(s_query.VALUE("satir").toInt())                                        .arg(s_query.VALUE("soldan_bosluk").toInt())                                        );            degiskenler_code_str.append(" }");            degiskenler_eklendi = true;            tasarim_sayisi++;        }        ////////////////////////////////////////////        if ( eklenecek_belge_sayisi NE 0) {            belgeler_code_str.append(",/n");        }        belgeler_code_str.append("/t{ ");        belgeler_code_str.append(QString ("/"%1/",/"%2/",/"%3/",/"%4/",/"%6/",/"%8/",/"%9/",/"%10/",/""                                          "%11/",%12,/"%13/",/"%14/",/"%15/",/"%16/",/"%17/"")                                    .arg(f_query.VALUE("belge_id").toString())                                    .arg(f_query.VALUE("row_count").toString())                                    .arg(f_query.VALUE("row_space_satir").toString())                                    .arg(f_query.VALUE("belge_satir_sayisi").toString())                                    .arg(f_query.VALUE("belge_toplam_karakter_sayisi").toString())                                    .arg(f_query.VALUE("kopya_sayisi").toString())                                    .arg(f_query.VALUE("kopya_konumu").toString())                                    .arg(f_query.VALUE("printer_type").toString())                                    .arg(f_query.VALUE("line_headers_visible").toString())                                    .arg(QVariant(tasarim_sayisi).toString())                                    .arg(f_query.VALUE("belge_width").toString())                                    .arg(f_query.VALUE("belge_height").toString())                                    .arg(f_query.VALUE("row_space_mm").toString())                                    .arg(f_query.VALUE("tasarim_adi").toString())                                    .arg(f_query.VALUE("html_str").toString()) );        belgeler_code_str.append(" }");        eklenecek_belge_sayisi++;    }    belgeler_code_str.append(",/n{ /"/",/"/",/"/",/"/",/"/",/"/",/"/",/"/",/"/",-1,/"/",/"/",/"/",/"/",/"/" }");    belgeler_code_str.append("/n};/n/n");    degiskenler_code_str.append(",/n{ /"/",/"/",/"/",/"/",-1,/"/",/"/",/"/",/"/",/"/", -1, 0, 0, /"/", 0, 0, 0, 0, 0, 0 }");    degiskenler_code_str.append("/n};/n/n");    //degiskenler_code_str.append(QString("int eklenecek_belge_sayisi = %1;").arg(eklenecek_belge_sayisi));    QFile degiskenler_file ("e9_default_belge_degiskenleri.h");    if (!degiskenler_file.open(QIODevice::WriteOnly | QIODevice::Text)) {        return;    }    QString header_begin = "#ifndef E9_DEFAULT_BELGE_DEGISKENLERI_H /n"                           "#define E9_DEFAULT_BELGE_DEGISKENLERI_H /n/n";    QString header_end   = "/n #endif";    QTextStream write_file (&degiskenler_file);    write_file << header_begin;    write_file << belgeler_code_str;    write_file << degiskenler_code_str;    write_file << header_end;    degiskenler_file.close();    ADAK_INFO (QObject::tr("e9_default_belge.h was rebuilt."),NULL,NULL);//e9_default_belge.h yeniden olu
C++ write_full函数代码示例
C++ write_error函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。