本文整理汇总了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 );
}
示例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 ) );
}
示例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 ) ;
}
示例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);
}
}
示例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;
}
示例6: write_Int
inline void write_Int(int n)
{
if(n<0)
{
write_char('-');
write_flush();
n *= (-1);
}
write_int(n);
}
示例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;
}
示例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;
}
示例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]);
}
示例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 );
}
示例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]);
}
示例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");
}
示例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;
}
示例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;
}
示例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");
}
}