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

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

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

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

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

示例1: input_callback

static gbooleaninput_callback (GIOChannel   *source,		GIOCondition  condition,		gpointer      data){  int val;  GIOChannel *dest = (GIOChannel *)data;    if (!read_all (source, (char *)&val, sizeof(val)))    {      fprintf (stderr, "Unexpected EOF/n");      exit (1);    }  if (val)    {      write_all (dest, (char *)&val, sizeof(val));            return TRUE;    }  else    {      g_io_channel_close (source);      g_io_channel_close (dest);            g_io_channel_unref (source);      g_io_channel_unref (dest);      n_active_children--;      if (n_active_children == 0)	g_main_loop_quit (loop);            return FALSE;    }}
开发者ID:north0808,项目名称:haina,代码行数:35,


示例2: do_read

static intdo_read(void){    int ret = -1;    char name[MAX_FILE_NAME_LENGTH + 1];    char *contents, *path;    struct file *file;    if (read_all(STDIN, name, MAX_FILE_NAME_LENGTH) != MAX_FILE_NAME_LENGTH)        return -1;    name[MAX_FILE_NAME_LENGTH] = '/0';    if ((path = get_path_from_dir(&vfs, pwd)) == NULL)        return -1;    if ((path = append_to_path(path, name)) == NULL)        goto free_path;    if ((file = lookup_file(&vfs, path, 1)) == NULL)        goto free_path;    if (read_file(&vfs, USER_UID, path, (unsigned char **)&contents) != 0)        goto free_path;    write_all(STDOUT, contents, file->size);    ret = 0;free_path:    free(path);    return ret;}
开发者ID:trailofbits,项目名称:cb-multios,代码行数:31,


示例3: grab_file

/* Be careful about trying to compile over running programs (parallel make). * temp_file helps here. */char *compile_info(const void *ctx, const char *dir){	char *info_c_file, *info, *compiled, *output;	int fd;	/* Copy it to a file with proper .c suffix. */	info = grab_file(ctx, tal_fmt(ctx, "%s/_info", dir));	if (!info)		return NULL;	info_c_file = temp_file(ctx, ".c", "_info");	fd = open(info_c_file, O_WRONLY|O_CREAT|O_EXCL, 0600);	if (fd < 0)		return NULL;	if (!write_all(fd, info, tal_count(info)-1))		return NULL;	if (close(fd) != 0)		return NULL;	compiled = temp_file(ctx, "", "info");	if (compile_and_link(ctx, info_c_file, find_ccan_dir(dir), "",			     compiler, cflags, "", compiled, &output))		return compiled;	return NULL;}
开发者ID:dooglus,项目名称:ccan,代码行数:28,


示例4: sun_write_disklabel

static int sun_write_disklabel(struct fdisk_context *cxt){	struct sun_disklabel *sunlabel;	unsigned short *ush;	unsigned short csum = 0;	const size_t sz = sizeof(struct sun_disklabel);	assert(cxt);	assert(cxt->label);	assert(fdisk_is_disklabel(cxt, SUN));	sunlabel = self_disklabel(cxt);	/* Maybe geometry has been modified */	sunlabel->nhead = cpu_to_be16(cxt->geom.heads);	sunlabel->nsect = cpu_to_be16(cxt->geom.sectors);	if (cxt->geom.cylinders != be16_to_cpu(sunlabel->ncyl))		sunlabel->ncyl = cpu_to_be16( cxt->geom.cylinders				      - be16_to_cpu(sunlabel->acyl) );	ush = (unsigned short *) sunlabel;	while(ush < (unsigned short *)(&sunlabel->csum))		csum ^= *ush++;	sunlabel->csum = csum;	if (lseek(cxt->dev_fd, 0, SEEK_SET) < 0)		return -errno;	if (write_all(cxt->dev_fd, sunlabel, sz) != 0)		return -errno;	return 0;}
开发者ID:Kynde,项目名称:util-linux,代码行数:33,


示例5: write_block

static void write_block(const struct fs_control *ctl, int blk, char * buffer) {	if (blk * MINIX_BLOCK_SIZE != lseek(ctl->device_fd, blk * MINIX_BLOCK_SIZE, SEEK_SET))		errx(MKFS_EX_ERROR, _("%s: seek failed in write_block"), ctl->device_name);	if (write_all(ctl->device_fd, buffer, MINIX_BLOCK_SIZE))		errx(MKFS_EX_ERROR, _("%s: write failed in write_block"), ctl->device_name);}
开发者ID:Kaligule,项目名称:util-linux,代码行数:7,


示例6: write_line

static int write_line(const char *line){	if (write_all(sock, line, strlen(line)) == -1)		die_errno("write");	return read_answer();}
开发者ID:kcrossan,项目名称:libcmus,代码行数:7,


示例7: copy_body

void copy_body(amqp_connection_state_t conn, int fd){  size_t body_remaining;  amqp_frame_t frame;  int res = amqp_simple_wait_frame(conn, &frame);  die_amqp_error(res, "waiting for header frame");  if (frame.frame_type != AMQP_FRAME_HEADER) {    die("expected header, got frame type 0x%X",        frame.frame_type);  }  body_remaining = frame.payload.properties.body_size;  while (body_remaining) {    res = amqp_simple_wait_frame(conn, &frame);    die_amqp_error(res, "waiting for body frame");    if (frame.frame_type != AMQP_FRAME_BODY) {      die("expected body, got frame type 0x%X",          frame.frame_type);    }    write_all(fd, frame.payload.body_fragment);    body_remaining -= frame.payload.body_fragment.len;  }}
开发者ID:TimSimpsonR,项目名称:rabbitmq-c,代码行数:25,


示例8: accel_map_print

static voidaccel_map_print (gpointer        data,		 const gchar    *accel_path,		 guint           accel_key,		 GdkModifierType accel_mods,		 gboolean        changed){  GString *gstring = g_string_new (changed ? NULL : "; ");  gint fd = GPOINTER_TO_INT (data);  gchar *tmp, *name;  g_string_append (gstring, "(gtk_accel_path /"");  tmp = g_strescape (accel_path, NULL);  g_string_append (gstring, tmp);  g_free (tmp);  g_string_append (gstring, "/" /"");  name = gtk_accelerator_name (accel_key, accel_mods);  tmp = g_strescape (name, NULL);  g_free (name);  g_string_append (gstring, tmp);  g_free (tmp);  g_string_append (gstring, "/")/n");  write_all (fd, gstring->str, gstring->len);  g_string_free (gstring, TRUE);}
开发者ID:3dfxmadscientist,项目名称:gtk,代码行数:31,


示例9: log_lastlog

static void log_lastlog(struct login_context *cxt){	struct sigaction sa, oldsa_xfsz;	struct lastlog ll;	time_t t;	int fd;	if (!cxt->pwd)		return;	/* lastlog is huge on systems with large UIDs, ignore SIGXFSZ */	memset(&sa, 0, sizeof(sa));	sa.sa_handler = SIG_IGN;	sigaction(SIGXFSZ, &sa, &oldsa_xfsz);	fd = open(_PATH_LASTLOG, O_RDWR, 0);	if (fd < 0)		goto done;	if (lseek(fd, (off_t) cxt->pwd->pw_uid * sizeof(ll), SEEK_SET) == -1)		goto done;	/*	 * Print last log message.	 */	if (!cxt->quiet) {		if (read(fd, (char *)&ll, sizeof(ll)) == sizeof(ll) &&							ll.ll_time != 0) {			time_t ll_time = (time_t) ll.ll_time;			printf(_("Last login: %.*s "), 24 - 5, ctime(&ll_time));			if (*ll.ll_host != '/0')				printf(_("from %.*s/n"),				       (int)sizeof(ll.ll_host), ll.ll_host);			else				printf(_("on %.*s/n"),				       (int)sizeof(ll.ll_line), ll.ll_line);		}		if (lseek(fd, (off_t) cxt->pwd->pw_uid * sizeof(ll), SEEK_SET) == -1)			goto done;	}	memset((char *)&ll, 0, sizeof(ll));	time(&t);	ll.ll_time = t;		/* ll_time is always 32bit */	if (cxt->tty_name)		xstrncpy(ll.ll_line, cxt->tty_name, sizeof(ll.ll_line));	if (cxt->hostname)		xstrncpy(ll.ll_host, cxt->hostname, sizeof(ll.ll_host));	if (write_all(fd, (char *)&ll, sizeof(ll)))		warn(_("write lastlog failed"));done:	if (fd >= 0)		close(fd);	sigaction(SIGXFSZ, &oldsa_xfsz, NULL);		/* restore original setting */}
开发者ID:sebras,项目名称:util-linux,代码行数:60,


示例10: handle_connection

void handle_connection(void *pointer){    connection_info info = *(connection_info *) pointer;    free(pointer);    //printf("New Connection/n");    if(info.counter%100==0){        char buff[256];        sprintf(buff, "unikitty/net_%d.part", info.counter);        // save_network(info.net, buff);    }    int fd = info.fd;    network net = info.net;    int i;    for(i = 0; i < net.n; ++i){        if(net.layers[i].type == CONVOLUTIONAL){            convolutional_layer layer = net.layers[i];            read_and_add_into(fd, layer.bias_updates, layer.n);            int num = layer.n*layer.c*layer.size*layer.size;            read_and_add_into(fd, layer.filter_updates, num);        }        if(net.layers[i].type == CONNECTED){            connected_layer layer = net.layers[i];            read_and_add_into(fd, layer.bias_updates, layer.outputs);            read_and_add_into(fd, layer.weight_updates, layer.inputs*layer.outputs);        }    }    for(i = 0; i < net.n; ++i){        if(net.layers[i].type == CONVOLUTIONAL){            convolutional_layer layer = net.layers[i];            // update_convolutional_layer(layer);            write_all(fd, (char*) layer.biases, layer.n*sizeof(float));            int num = layer.n*layer.c*layer.size*layer.size;            write_all(fd, (char*) layer.filters, num*sizeof(float));        }        if(net.layers[i].type == CONNECTED){            connected_layer layer = net.layers[i];            // update_connected_layer(layer);            write_all(fd, (char *)layer.biases, layer.outputs*sizeof(float));            write_all(fd, (char *)layer.weights, layer.outputs*layer.inputs*sizeof(float));        }    }    //printf("Received updates/n");    close(fd);}
开发者ID:WildbookOrg,项目名称:pydarknet,代码行数:47,


示例11: resizetty

static int resizetty(void){	/* 	 * /e7        Save current state (cursor coordinates, attributes,	 *                character sets pointed at by G0, G1).	 * /e[r       Set scrolling region; parameters are top and bottom row.	 * /e[32766E  Move cursor down 32766 (INT16_MAX - 1) rows.	 * /e[32766C  Move cursor right 32766 columns.	 * /e[6n      Report cursor position.	 * /e8        Restore state most recently saved by /e7.	 */	static const char *getpos = "/e7/e[r/e[32766E/e[32766C/e[6n/e8";	char retstr[32];	int row, col;	size_t pos;	ssize_t rc;	struct winsize ws;	struct termios saved_attributes;	int saved_fl;	if (!isatty(STDIN_FILENO))		errx(EXIT_FAILURE, _("stdin does not refer to a terminal"));	tty_raw(&saved_attributes, &saved_fl);	if (write_all(STDIN_FILENO, getpos, strlen(getpos)) < 0) {		warn(_("write failed"));		tty_restore(&saved_attributes, &saved_fl);		return 1;	}	for (pos = 0; pos < sizeof(retstr) - 1;) {		if (0 == select_wait())			break;		if ((rc =		     read(STDIN_FILENO, retstr + pos,			  sizeof(retstr) - 1 - pos)) < 0) {			if (errno == EINTR)				continue;			warn(_("read failed"));			tty_restore(&saved_attributes, &saved_fl);			return 1;		}		pos += rc;		if (retstr[pos - 1] == 'R')			break;	}	retstr[pos] = 0;	tty_restore(&saved_attributes, &saved_fl);	rc = sscanf(retstr, "/033[%d;%dR", &row, &col);	if (rc != 2) {		warnx(_("invalid cursor position: %s"), retstr);		return 1;	}	memset(&ws, 0, sizeof(struct winsize));	ioctl(STDIN_FILENO, TIOCGWINSZ, &ws);	ws.ws_row = row;	ws.ws_col = col;	ioctl(STDIN_FILENO, TIOCSWINSZ, &ws);	return 0;}
开发者ID:Webster-WXH,项目名称:util-linux,代码行数:59,


示例12: bash_completion_main

intbash_completion_main(const struct cmd_bash_completion_info* info){    const char* fb_adb_binary = orig_argv0;#ifdef HAVE_REALPATH    // If argv0 isn't a relative or absolute path, assume we got it    // from PATH and don't touch it.    if (strchr(fb_adb_binary, '/'))        fb_adb_binary = xrealpath(fb_adb_binary);#endif    char* argv0_line = xaprintf(        ": ${_fb_adb:=%s}/n",        xshellquote(fb_adb_binary));    write_all(STDOUT_FILENO, argv0_line, strlen(argv0_line));    write_all(STDOUT_FILENO, bash_completion, sizeof (bash_completion));    return 0;}
开发者ID:Learn-Android-app,项目名称:fb-adb,代码行数:17,


示例13: send_xfer_msg

static voidsend_xfer_msg(int to_peer, const struct xfer_msg* m){    dbg("sending xfer message type=%u size=%u",        (unsigned) m->type,        (unsigned) xfer_msg_size(m->type));    write_all(to_peer, m, xfer_msg_size(m->type));}
开发者ID:liyongming1982,项目名称:fb-adb,代码行数:8,


示例14: request

void SvgSubprocessCharacterGenerator::request( ) {    const char *dummy = "";    if (write_all(send_fd, dummy, 1) != 1) {        throw std::runtime_error("dead subprocess?");    }    fsync(send_fd);}
开发者ID:pymlofy,项目名称:exagl,代码行数:8,


示例15: tlv_fwrite

int tlv_fwrite(tlv_t *tlv, int fd) {        unsigned int to_write = TLV_SIZEOF(tlv);        int status = write_all(fd, *tlv, to_write);        if (status == -1 || (unsigned int)status != to_write) {                ERROR("write", -1);        }        return 0;}
开发者ID:bfontaine,项目名称:Dazibao,代码行数:8,


示例16: run_client_thread

static gpointerrun_client_thread (gpointer data){	gint *socket = data;	GkdSshAgentCall call;	EggBuffer req;	EggBuffer resp;	guchar op;	g_assert (GP11_IS_MODULE (pkcs11_module));	memset (&call, 0, sizeof (call));	call.sock = g_atomic_int_get (socket);	g_assert (call.sock != -1);	egg_buffer_init_full (&req, 128, egg_secure_realloc);	egg_buffer_init_full (&resp, 128, (EggBufferAllocator)g_realloc);	call.req = &req;	call.resp = &resp;	call.module = g_object_ref (pkcs11_module);	for (;;) {		egg_buffer_reset (call.req);		/* 1. Read in the request */		if (!read_packet_with_size (&call))			break;		/* 2. Now decode the operation */		if (!egg_buffer_get_byte (call.req, 4, NULL, &op))			break;		if (op >= GKD_SSH_OP_MAX)			break;		g_assert (gkd_ssh_agent_operations[op]);		/* 3. Execute the right operation */		egg_buffer_reset (call.resp);		egg_buffer_add_uint32 (call.resp, 0);		if (!(gkd_ssh_agent_operations[op]) (&call))			break;		if (!egg_buffer_set_uint32 (call.resp, 0, call.resp->len - 4))			break;		/* 4. Write the reply back out */		if (!write_all (call.sock, call.resp->buf, call.resp->len))			break;	}	egg_buffer_uninit (&req);	egg_buffer_uninit (&resp);	g_object_unref (call.module);	close (call.sock);	g_atomic_int_set (socket, -1);	return NULL;}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:58,


示例17: send_error_packet

static voidsend_error_packet(int to_peer, int err, const char* msg){    size_t msg_size = strlen(msg);    if (msg_size > UINT16_MAX)        msg_size = UINT16_MAX;    struct xfer_msg m = {        .type = XFER_MSG_ERROR,        .u.error.err = err,        .u.error.msg_size = msg_size,    };    send_xfer_msg(to_peer, &m);    write_all(to_peer, msg, msg_size);}intxfer_stub_main(const struct cmd_xfer_stub_info* info){    struct xfer_ctx ctx = {        .from_peer = STDIN_FILENO,        .to_peer = STDOUT_FILENO,        .info = info,    };    struct errinfo ei = {        .want_msg = true    };    if (catch_error(do_xfer, &ctx, &ei)) {        send_error_packet(ctx.to_peer, ei.err, ei.msg);        return 1;    }    return 0;}#if FBADB_MAINintxfer_handle_command(    const struct start_peer_info* spi,    const struct cmd_xfer_stub_info* local,    const struct cmd_xfer_stub_info* remote){    struct child* peer = start_peer(        spi,        make_args_cmd_xfer_stub(            CMD_ARG_NAME | CMD_ARG_FORWARDED,            remote));    struct xfer_ctx ctx = {        .from_peer = peer->fd[1]->fd,        .to_peer = peer->fd[0]->fd,        .info = local,    };    do_xfer(&ctx);    return child_status_to_exit_code(child_wait(peer));}
开发者ID:liyongming1982,项目名称:fb-adb,代码行数:58,


示例18: d8x8matrix_cls

void d8x8matrix_cls(const device_info_t *device_info) {	write_all(device_info, MAX7219_REG_DIGIT0, 0);	write_all(device_info, MAX7219_REG_DIGIT1, 0);	write_all(device_info, MAX7219_REG_DIGIT2, 0);	write_all(device_info, MAX7219_REG_DIGIT3, 0);	write_all(device_info, MAX7219_REG_DIGIT4, 0);	write_all(device_info, MAX7219_REG_DIGIT5, 0);	write_all(device_info, MAX7219_REG_DIGIT6, 0);	write_all(device_info, MAX7219_REG_DIGIT7, 0);}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:10,


示例19: http_write_header

static ssize_thttp_write_header (int fd, Http_header *header){  ssize_t n = 0, m;  if (header == NULL)    return write_all (fd, "/r/n", 2);  m = write_all (fd, (void *)header->name, strlen (header->name));  if (m == -1)    {      return -1;    }  n += m;  m = write_all (fd, ": ", 2);  if (m == -1)    {      return -1;    }  n += m;  m = write_all (fd, (void *)header->value, strlen (header->value));  if (m == -1)    {      return -1;    }  n += m;  m = write_all (fd, "/r/n", 2);  if (m == -1)    {      return -1;    }  n += m;  m = http_write_header (fd, header->next);  if (m == -1)    {      return -1;    }  n += m;  return n;}
开发者ID:340211173,项目名称:httptunnel,代码行数:45,


示例20: next

static struct io_plan *simple_write(struct io_conn *conn,				    const void *data, size_t len,				    struct io_plan *(*next)(struct io_conn *, void *),				    void *arg){	if (!write_all(conn->fd, data, len))		err(1, "Writing data");	return next(conn, arg);}
开发者ID:cdecker,项目名称:lightning,代码行数:9,


示例21: eof_ui_deregister

int eof_ui_deregister(int sockfd){   /* submit deregister command: cmd_2101.c */   if(write_all(sockfd, EOF_CMD_UI_DEREGISTER, EOF_L_CMD) != EOF_L_CMD) {      return 0;   }    return 1;}
开发者ID:telmich,项目名称:ceofhack,代码行数:9,


示例22: server_write_pty

static bool server_write_pty(Packet *pkt) {	print_packet("server-write-pty:", pkt);	size_t size = pkt->len;	if (write_all(server.pty, pkt->u.msg, size) == size)		return true;	debug("FAILED/n");	server.running = false;	return false;}
开发者ID:eworm-de,项目名称:abduco,代码行数:9,


示例23: vserver_read_req

static void vserver_read_req(u32 sec, u32 count){    struct vserver_cmd cmd;    cmd.command = htonl(MFS_CMD_READ);    cmd.param1 = htonl(sec);    cmd.param2 = htonl(count);    write_all(vserver, &cmd, sizeof(cmd));}
开发者ID:elitak,项目名称:mfs-utils,代码行数:9,


示例24: vserver_list_sectors_req

static void vserver_list_sectors_req(u32 sec, u32 count){    struct vserver_cmd cmd;    cmd.command = htonl(MFS_CMD_LIST_SECTORS);    cmd.param1 = htonl(sec);    cmd.param2 = htonl(count);    write_all(vserver, &cmd, sizeof(cmd));}
开发者ID:elitak,项目名称:mfs-utils,代码行数:9,


示例25: test_badargs

/* Test for bad args. */void test_badargs (void){    char *buf;    errno = 0;    ok (write_all (-1, "", 1) < 0 && errno == EINVAL,        "write_all fd=-1 fails with EINVAL");    errno = 0;    ok (write_all (STDOUT_FILENO, NULL, 1) < 0 && errno == EINVAL,        "write_all buf=NULL fails with EINVAL");    errno = 0;    ok (read_all (-1, (void **)&buf) < 0 && errno == EINVAL,        "read_all fd=-1 fails with EINVAL");    errno = 0;    ok (read_all (STDIN_FILENO, NULL) < 0 && errno == EINVAL,        "read_all buf=NULL fails with EINVAL");}
开发者ID:trws,项目名称:flux-core,代码行数:20,


示例26: oss_write_audio

static void oss_write_audio(gpointer data, int length){	audio_buf_info abuf_info;	AFormat new_format;	int new_frequency, new_channels;	EffectPlugin *ep;		new_format = input.format.xmms;	new_frequency = input.frequency;	new_channels = input.channels;		ep = get_current_effect_plugin();	if(effects_enabled() && ep && ep->query_format)	{		ep->query_format(&new_format,&new_frequency,&new_channels);	}		if (new_format != effect.format.xmms ||	    new_frequency != effect.frequency ||	    new_channels != effect.channels)	{		output_time_offset += (output_bytes * 1000) / output.bps;		output_bytes = 0;		close(fd);		fd = open(device_name,O_WRONLY);		oss_setup_format(new_format, new_frequency, new_channels);	}	if (effects_enabled() && ep && ep->mod_samples)		length = ep->mod_samples(&data, length,					 input.format.xmms,					 input.frequency,					 input.channels);	if (realtime && !ioctl(fd, SNDCTL_DSP_GETOSPACE, &abuf_info))	{		while (abuf_info.bytes < length)		{			xmms_usleep(10000);			if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &abuf_info))				break;		}	}	if (oss_convert_func != NULL)		length = oss_convert_func(&data, length);	if (oss_stereo_convert_func != NULL)		length = oss_stereo_convert_func(&data, length,						 output.format.oss);	if (effect.frequency == output.frequency)		output_bytes += write_all(fd, data, length);	else		output_bytes += oss_downsample(data, length,					       effect.frequency,					       output.frequency);}
开发者ID:sedwards,项目名称:xmms3,代码行数:56,


示例27: sgi_write_disklabel

static int sgi_write_disklabel(struct fdisk_context *cxt){	struct sgi_disklabel *sgilabel;	struct sgi_info *info = NULL;	assert(cxt);	assert(cxt->label);	assert(fdisk_is_disklabel(cxt, SGI));	sgilabel = self_disklabel(cxt);	sgilabel->csum = 0;	sgilabel->csum = cpu_to_be32(sgi_pt_checksum(sgilabel));	assert(sgi_pt_checksum(sgilabel) == 0);	if (lseek(cxt->dev_fd, 0, SEEK_SET) < 0)		goto err;	if (write_all(cxt->dev_fd, sgilabel, DEFAULT_SECTOR_SIZE))		goto err;	if (!strncmp((char *) sgilabel->volume[0].name, "sgilabel", 8)) {		/*		 * keep this habit of first writing the "sgilabel".		 * I never tested whether it works without (AN 981002).		 */		int infostartblock			= be32_to_cpu(sgilabel->volume[0].block_num);		if (lseek(cxt->dev_fd, (off_t) infostartblock *					DEFAULT_SECTOR_SIZE, SEEK_SET) < 0)			goto err;		info = sgi_new_info();		if (!info)			goto err;		if (write_all(cxt->dev_fd, info, sizeof(*info)))			goto err;	}	sgi_free_info(info);	return 0;err:	sgi_free_info(info);	return -errno;}
开发者ID:TacheR,项目名称:util-linux,代码行数:43,


示例28: bdev_write_block

static int bdev_write_block(struct device *dev, const char *buf, int length,	uint64_t offset){	struct block_device *bdev = dev_bdev(dev);	off_t off_ret = lseek(bdev->fd, offset, SEEK_SET);	if (off_ret < 0)		return - errno;	assert((uint64_t)off_ret == offset);	return write_all(bdev->fd, buf, length);}
开发者ID:WolfieNuke,项目名称:f3,代码行数:10,


示例29: send_status_and_crc

void send_status_and_crc(int code, const char *last_filename) {	struct result_header hdr;	struct result_header_ext hdr_ext;	int saved_errno;	saved_errno = errno;	hdr.error_code = code;	hdr.crc32 = crc32_sum;	if (!write_all(1, &hdr, sizeof(hdr)))		perror("write status");	if (last_filename) {		hdr_ext.last_namelen = strlen(last_filename);		if (!write_all(1, &hdr_ext, sizeof(hdr_ext)))			perror("write status ext");		if (!write_all(1, last_filename, hdr_ext.last_namelen))			perror("write last_filename");	}	errno = saved_errno;}
开发者ID:Galland,项目名称:qubes-linux-utils,代码行数:19,


示例30: write_all

/*  re-initialise, using current mem_buffer */bool AP_FlashStorage::re_initialise(void){    if (!flash_erase_ok()) {        return false;    }    if (!erase_all()) {        return false;            }    return write_all();}
开发者ID:BrendanSmith,项目名称:ardupilot,代码行数:13,



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


C++ write_atom_header函数代码示例
C++ writeWord函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。