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


C++ write_int函数代码示例

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


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

示例1: write_pointer

static void write_pointer( FILE *f, void *p, ptr_type_t type ) {
    const save_ptr_t *ptr;
    int i;

    if( !p ) {
        write_int( f, -1 );
        return;
    }

    for( i = 0, ptr = save_ptrs; i < num_save_ptrs; i++, ptr++ ) {
        if( ptr->type == type && ptr->ptr == p ) {
            write_int( f, i );
            return;
        }
    }

    gi.error( "%s: unknown pointer: %p", __func__, p );
}
开发者ID:Bad-ptr,项目名称:q2pro,代码行数:18,代码来源:g_save.c

示例2: write_index

static void write_index( FILE *f, void *p, size_t size, void *start, int max_index ) {
    size_t diff;

    if( !p ) {
        write_int( f, -1 );
        return;
    }

    if( p < start || ( byte * )p > ( byte * )start + max_index * size ) {
        gi.error( "%s: pointer out of range: %p", __func__, p );
    }

    diff = p - start;
    if( diff % size ) {
        gi.error( "%s: misaligned pointer: %p", __func__, p );
    }
    write_int( f, ( int )( diff / size ) );
}
开发者ID:Bad-ptr,项目名称:q2pro,代码行数:18,代码来源:g_save.c

示例3: write_int

 inline void write_int( LL n ) 
 {
     //recursive function to load the number to output buffer array(buf2)
     if( n >= 10 ) 
     {
         write_int( n / 10 ) ;
     }
         write_char( '0' + n % 10 ) ;
 }
开发者ID:aqfaridi,项目名称:Competitve-Programming-Codes,代码行数:9,代码来源:FASTFLOW.cpp

示例4: write_string

static void write_string(int fd, char* val) {
    int len = strlen(val);
    write_int(fd, len);
    int written = write(fd, val, len);
    if (written != len) {
        PLOGE("unable to write string");
        exit(-1);
    }
}
开发者ID:Lekensteyn,项目名称:Superuser,代码行数:9,代码来源:daemon.c

示例5: assert

void UniformSymbolCoder<RAC>::write_int(int min, int max, int val) {
        assert(max >= min);
        if (min != 0) {
            max -= min;
            val -= min;
        }
        if (max == 0) return;

        // split in [0..med] [med+1..max]
        int med = max/2;
        if (val > med) {
            rac.write_bit(true);
            write_int(med+1, max, val);
        } else {
            rac.write_bit(false);
            write_int(0, med, val);
        }
        return;
}
开发者ID:hfr1988,项目名称:spot,代码行数:19,代码来源:symbol_enc.hpp

示例6: write_Int

 inline void write_Int(int n)
 {
     if(n<0)
     {
         write_char('-');
         write_flush();
         n *= (-1);
     }
     write_int(n);
 }
开发者ID:aqfaridi,项目名称:Competitve-Programming-Codes,代码行数:10,代码来源:IITKWPCB_fast.cpp

示例7:

generator_callback *remote_completion(const char *line, int start)
{
	if (write(server_completion_fd, "c", 1) != 1 ||
		!write_int(server_completion_fd, start) ||
		!write_string(server_completion_fd, line)) {
		return NULL;
	}

	return remote_generator;
}
开发者ID:aragua,项目名称:haka,代码行数:10,代码来源:user_remote.c

示例8: listend

/* stringlist: <# listitems>
               <pos of listend (bytes)>
               <string:(size)(aligned string)>
*/
static int bc_stringlist_emit(int fd, int *codep, bytecode_info_t *bc)
{
    int len = bc->data[(*codep)++].len;
    int i;
    int ret;
    int wrote = 2*sizeof(int);
    int begin,end;

    /* Write out number of items in the list */
    if (write_int(fd, len)== -1) return -1 ;

    /* skip one spot end of list position*/
    begin=lseek(fd,0,SEEK_CUR);
    lseek(fd,sizeof(int),SEEK_CUR);

    /* Loop through all the items of the list, writing out length and string
     * in sequence */
    for(i=0; i < len; i++)
    {
        int datalen = bc->data[(*codep)++].len;

        if(write_int(fd, datalen) == -1) return -1;
        wrote += sizeof(int);

        if(write(fd, bc->data[(*codep)++].str, datalen) == -1) return -1;
        wrote += datalen;

        ret = align_string(fd,datalen);
        if(ret == -1) return -1;

        wrote+=ret;
    }
    end=lseek(fd,0,SEEK_CUR);
    if (end < 0) return -1;

    /* go back and write end of list position */
    lseek(fd,begin,SEEK_SET);
    if(write_int(fd, end) == -1) return -1;

    /* return to the end */
    lseek(fd,end,SEEK_SET);
    return wrote;
}
开发者ID:kolab-groupware,项目名称:cyrus-imapd,代码行数:47,代码来源:bc_emit.c

示例9: write_string

static void
write_string (MonoCompile *cfg, const char *str)
{
	size_t len = strnlen (str, 0x2000);
	write_int (cfg, (int) len);

	gunichar2 *u = u8to16 (str);
	for (int i = 0; i < len; i++)
		write_short (cfg, u[i]);
}
开发者ID:LogosBible,项目名称:mono,代码行数:10,代码来源:cfgdump.c

示例10: len_string

void KfmServIpc::dirEntry(const char* _name, const char* _access, const char* _owner, const char* _group, const char* _date, int _size)
{
	int len = 0;
	len += len_string( _name );
	len += len_string( _access );
	len += len_string( _owner );
	len += len_string( _group );
	len += len_string( _date );
	len += len_int( _size );
	len += len_string("dirEntry");
	write_int( data_sock->socket(), len );
	write_string( data_sock->socket(), "dirEntry" );
	write_string( data_sock->socket(), _name );
	write_string( data_sock->socket(), _access );
	write_string( data_sock->socket(), _owner );
	write_string( data_sock->socket(), _group );
	write_string( data_sock->socket(), _date );
	write_int( data_sock->socket(), _size );
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:19,代码来源:kfmserver_ipc2.cpp

示例11: write_endpList

HOT_INLINE
static void write_endpList(
    int size, 
    hot_endpt_t *ep
) {
    int i;
    write_int(size);
    for (i = 0; i < size; i++)
	write_endpID(&ep[i]);
}
开发者ID:4og,项目名称:avango,代码行数:10,代码来源:hot_outboard_c.c

示例12: log_realloc

static 
log_realloc (unsigned oldlen, unsigned newlen, unsigned bsize, char *addr)
{
	write_string ("realloc of ");
	write_int (oldlen);
	write_string ("at ");
	write_addr (addr);
	write_string ("\n");
	write_stack("x");

	write_string ("realloc-to of ");
	write_int (newlen);
	write_string ("gets ");
	write_int (bsize);
	write_string ("at ");
	write_addr (addr);
	write_string ("\n");
	write_stack("x");
}
开发者ID:Kampbell,项目名称:isode-8.0,代码行数:19,代码来源:malloc.c

示例13: main

int main(void)
{
    char mac_param[128];

    write_int("/sys/devices/platform/msm_sdcc.3/polling", 1);
    
    getmac(mac_param);
    LOGI("Loading Libra.ko");
    if ((insmod(DRIVER_MODULE_PATH, mac_param)) < 0){
        rmmod("librasdioif");
    } else {
        usleep(WIFI_DRIVER_LOADER_DELAY);
        property_set("wlan.driver.status", "ok");       
    }

    write_int("/sys/devices/platform/msm_sdcc.3/polling", 0);

    return 0;
}
开发者ID:QuietStorm1785,项目名称:updated_warp_cm_configs,代码行数:19,代码来源:load_libra.c

示例14: write_int

    void write_int(int min, int max, int val) {
        assert(max >= min);
        if (min != 0) {
            max -= min;
            val -= min;
        }
        if (max == 0) return;

        // split in [0..med] [med+1..max]
        int med = max/2;
        if (val > med) {
            rac.write(med+1, max+1, true);
            write_int(med+1, max, val);
        } else {
            rac.write(med+1, max+1, false);
            write_int(0, med, val);
        }
        return;
    }
开发者ID:kif,项目名称:FLIF,代码行数:19,代码来源:symbol.hpp

示例15: print_free_list

static 
print_free_list (unsigned heap)
{
	int i;
	struct freelist * top;
	struct freelist * ptr;

	write_string ("free list for heap ");
	write_int(heap);
	write_string(":\n");
	for (i=0; i<BUCKETS; i++) {
		top = &heaps[heap][i];
		write_int (sizes[i]);
		write_string (": ");
		for (ptr = top->next ; ptr != top; ptr=ptr->next)
			write_int (ptr->size);
		write_string ("\n");
	}
}
开发者ID:Kampbell,项目名称:isode-8.0,代码行数:19,代码来源:malloc.c


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