本文整理汇总了C++中read_info函数的典型用法代码示例。如果您正苦于以下问题:C++ read_info函数的具体用法?C++ read_info怎么用?C++ read_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: music_info_init
/*----------------------------------------------------------------------------*/
void music_info_init(void)
{
#ifdef USB_SD_DECODE_DEFAULT_REP_OFF
play_mode=REPEAT_OFF;
#else
play_mode = read_info(MEM_PLAY_MODE);
if (play_mode > REPEAT_RANDOM)
{
play_mode = REPEAT_ALL;
}
#endif
if (given_device == 0) //设备启动时,given_device为0;
{
given_device = read_info(MEM_ACTIVE_DEV);
if ((given_device != 0x01) && (given_device != 0x02))
{
given_device = 0x01;
given_file_number = 1;
}
}
eq_mode = read_info(MEM_EQ_MODE);
if (eq_mode > CLASSIC)
{
eq_mode = NORMAL;
}
}
示例2: request_usr
int request_usr(simple_person ** arr, int * size, int id,char * conect, tOPC opc)
{
char opOK=0,qty_people=0;
int full_size;
clsvbuff buff;
initConnection(TYPE_MSG_Q);
buff.opc=opc;
buff.id_client=id;
write_info(&buff);
read_info(&opOK,sizeof(char),buff.id_client);
if(opOK==NOTOK)
{
return NOTOK;
}
read_info((char*)&qty_people,sizeof(char),buff.id_client);
*size=qty_people;
full_size=sizeof(simple_person) * (*size);
if(full_size>0)
{
*arr=malloc(full_size);
if(*arr==NULL)
return NOTOK;
read_info((char*) (*arr),full_size,buff.id_client);
}
return OK;
}
示例3: read_radio_freq
u16 read_radio_freq(u8 ch)
{
xd_u16 freq_reg=0;
freq_reg = read_info(ch+1);
freq_reg=freq_reg<<8;
freq_reg |= read_info(ch);
return freq_reg;
}
示例4: read_radio_freq
u16 read_radio_freq(u8 ch)
{
xd_u16 freq_reg=0;
ch=ch<<1;
freq_reg = read_info(MEM_FM_CHANNL +ch+1);
freq_reg=freq_reg<<8;
freq_reg |= read_info(MEM_FM_CHANNL +ch);
return freq_reg;
}
示例5: restore_music_point
/*----------------------------------------------------------------------------*/
void restore_music_point(void)
{
u8 i;
for (i = 0;i<10;i++)
{
((u8 *)(&(disk_mus_point[0].id0)))[i] = read_info(MEM_SD_PLAYPOINT_ID0+i);
}
for (i = 0;i<10;i++)
{
((u8 *)(&(disk_mus_point[1].id0)))[i] = read_info(MEM_USB_PLAYPOINT_ID0+i);
}
}
示例6: print_list_rest
void
print_list_rest (FILE * in)
{
char stringBuf[1024];
GList *ac = NULL;
GList *list = read_info (in);
list = g_list_sort (list, CompareAccountByUsername);
printf (" USER REASON PERIOD LEVEL TIME LEFT(s)\n");
for (ac = g_list_first (list); ac != NULL; ac = g_list_next (ac))
{
Account *_ac = (Account *) ac->data;
if (_ac->info.field_restrict != NO_PERIOD)
{
//printf( " %-16s %-6s %-6s %c %-4d\n",
printf (" %-16s %-6s %-6s %c %d\n", _ac->id, //name
read_restrict_reason (_ac), //reason
read_restrict_reriod (_ac), //period
get_restrict_level (_ac->restricted), //level
get_time_to_end (_ac) //time left
);
}
free (_ac->id);
free (_ac);
}
g_list_free (list);
}
示例7: main
int main()
{
char service_name[256];
printf("Input service name you want to connect:\n");
fgets(service_name, sizeof(service_name), stdin);
if (service_name[strlen(service_name) - 1] == '\n')
service_name[strlen(service_name) - 1] = '\0';
if (!connect_to_service(service_name)) {
fprintf(stderr, "connect_to_service failed\n");
exit(EXIT_FAILURE);
}
if (!read_info()) {
fprintf(stderr, "read_info failed\n");
exit(EXIT_FAILURE);
}
if (socketfd != -1) {
close(socketfd);
}
exit(EXIT_SUCCESS);
}
示例8: main
int
main(int argc, char *argv[])
{
char *p;
size_t len;
Subrange *r;
int (*fn)(Rune **r0, Rune **r1, Rune **r2, Rune **r3);
p = strrchr(argv[0], '/');
p = p? p+1 : argv[0];
switch (*p) {
case 'c' : fn = fn_c; break;
case 'i' : fn = fn_i; break;
case 'd' : fn = fn_d; break;
case 'a' : fn = fn_a; break;
default:
fprintf(stderr,"Uknown program name!\n");
exit(1);
}
if (*p != 'd') {
if (argc < 2) {
fprintf(stderr,"%c: need text argument\n", *p);
exit(1);
}
argtorune(argv[1]);
}
read_info(0); /* don't reverse ranges */
do_changes(fn);
list_changes();
exit(0);
}
示例9: get_connections_complete
static void get_connections_complete(int sk, void *buf, size_t len)
{
struct mgmt_rp_get_connections *rp = buf;
struct controller_info *info;
uint16_t index;
int i;
if (len < sizeof(*rp)) {
error("Too small get_connections complete event");
return;
}
if (len < (sizeof(*rp) + (rp->conn_count * sizeof(bdaddr_t)))) {
error("Too small get_connections complete event");
return;
}
index = btohs(bt_get_unaligned(&rp->index));
if (index > max_index) {
error("Unexpected index %u in get_connections complete",
index);
return;
}
info = &controllers[index];
for (i = 0; i < rp->conn_count; i++) {
bdaddr_t *bdaddr = g_memdup(&rp->conn[i], sizeof(bdaddr_t));
info->connections = g_slist_append(info->connections, bdaddr);
}
read_info(sk, index);
}
示例10: music_info_init
/*----------------------------------------------------------------------------*/
void music_info_init(void)
{
#ifdef NO_REM_LAST_DEV
given_device = NO_DEVICE;
#else
given_device = read_info(MEM_ACTIVE_DEV);
#endif
if (given_device == DEVICE_SDMMC0)
{
Set_Curr_Func(SYS_MP3DECODE_SD);
given_file_method = PLAY_FIRST_FILE;
given_device = DEVICE_SDMMC0;
put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE);
}
else if (given_device == DEVICE_UDISK)
{
Set_Curr_Func(SYS_MP3DECODE_USB);
given_file_method = PLAY_FIRST_FILE;
given_device = DEVICE_UDISK;
put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE);
}
else
{
Set_Curr_Func(SYS_MP3DECODE_USB);
given_file_method = PLAY_FIRST_FILE;
given_device = DEVICE_UDISK;
put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE);
}
}
示例11: open_index
int IndexFile::open_index(Asset *asset)
{
// use buffer if being built
this->asset = asset;
int result = 0;
if(asset->index_status == INDEX_BUILDING)
{
// use buffer
result = 0;
}
else
if(!(result = open_file()))
{
// opened existing file
if(read_info())
{
result = 1;
close_index();
}
else
{
asset->index_status = INDEX_READY;
}
}
else
{
result = 1;
}
return result;
}
示例12: GNUNET_PSEUDONYM_add
/**
* Add a pseudonym to the set of known pseudonyms.
* For all pseudonym advertisements that we discover
* FS should automatically call this function.
*
* @param cfg overall configuration
* @param id the pseudonym identifier
* @param meta metadata for the pseudonym
*/
void
GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *meta)
{
char *name;
int32_t ranking;
struct GNUNET_CONTAINER_MetaData *old;
char *fn;
struct stat sbuf;
ranking = 0;
fn = get_data_filename (cfg, PS_METADATA_DIR, id);
GNUNET_assert (fn != NULL);
if ((0 == STAT (fn, &sbuf)) &&
(GNUNET_OK == read_info (cfg, id, &old, &ranking, &name)))
{
GNUNET_CONTAINER_meta_data_merge (old, meta);
write_pseudonym_info (cfg, id, old, ranking, name);
GNUNET_CONTAINER_meta_data_destroy (old);
GNUNET_free_non_null (name);
}
else
{
write_pseudonym_info (cfg, id, meta, ranking, NULL);
}
GNUNET_free (fn);
internal_notify (id, meta, ranking);
}
示例13: do_info
int
do_info(const char *const *argv)
{
const char *thisarg;
struct partinfo *pi, ps;
struct dpkg_ar *part;
if (!*argv)
badusage(_("--%s requires one or more part file arguments"),
cipaction->olong);
while ((thisarg= *argv++)) {
part = dpkg_ar_open(thisarg);
if (!part)
ohshite(_("cannot open archive part file '%.250s'"), thisarg);
pi = read_info(part, &ps);
dpkg_ar_close(part);
if (pi) {
print_info(pi);
} else {
printf(_("file '%s' is not an archive part\n"), thisarg);
}
m_output(stdout, _("<standard output>"));
}
return 0;
}
示例14: lock
bool Channel::read_tile_or_closest_ancestor(TileIndex ti, TileIndex &ret_index, Tile &ret) const {
Locker lock(*this); // Lock self and hold lock until exiting this method
ChannelInfo info;
bool success = read_info(info);
if (!success) {
if (verbosity) log_f("read_tile_or_closest_ancestor: can't read info");
return false;
}
TileIndex root = info.nonnegative_root_tile_index;
if (ti.is_ancestor_of(root)) {
ret_index = root;
} else {
if (ti != root && !root.is_ancestor_of(ti)) {
// Tile isn't under root
return false;
}
assert(tile_exists(root));
ret_index = root;
while (ret_index != ti) {
TileIndex child = ti.start_time() < ret_index.left_child().end_time() ? ret_index.left_child() : ret_index.right_child();
if (!tile_exists(child)) break;
ret_index = child;
}
}
// ret_index now holds closest ancestor to ti (or ti itself if it exists)
assert(read_tile(ret_index, ret));
return true;
}
示例15: sys_info_init
/*----------------------------------------------------------------------------*/
static void sys_info_init(void)
{
//u8 vol_tmp;
#if 1
sys_main_vol = read_info(MEM_SYS_VOL);
if ((sys_main_vol > MAX_MAIN_VOL) || (sys_main_vol == 0)) //每次开机时,不要超过最大音量的一半,以免开机音量过大
{
sys_main_vol = 20;
}
#endif
dac_init(sys_main_vol);
delay_10ms(50); //等待,检测USB,SD在线状态
//init_rec_name();
//restore_music_point();
#if 0
#if RTC_ENABLE
if (work_mode != RTC_MODE)
#endif
{
device_check();
#if USB_DEVICE_ENABLE
if (pc_connect)
work_mode = USB_DEVICE_MODE;
else if (udisk_connect || sdmmc_connect)
work_mode = MUSIC_MODE;
#else
// if (udisk_connect || sdmmc_connect)
// work_mode = MUSIC_MODE;
#endif
}
#endif
}