本文整理汇总了C++中read_key函数的典型用法代码示例。如果您正苦于以下问题:C++ read_key函数的具体用法?C++ read_key怎么用?C++ read_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_key函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: check_deepest_dist
gint check_deepest_dist (TestData *td)
{
guint64 res;
VsgPRTreeKey2d k1, k2;
read_key (td->k1, &k1);
read_key (td->k2, &k2);
res = vsg_prtree_key2d_deepest_distance (&k1, &k2);
if (res != td->ref)
{
g_printerr ("Error - k1 = \"%s\" -> (", td->k1);
vsg_prtree_key2d_write (&k1, stderr);
g_printerr (") k2 = \"%s\" -> (", td->k2);
vsg_prtree_key2d_write (&k2, stderr);
g_printerr (") ref=%ld != res=%ld ", td->ref, res);
g_printerr ("\n");
return 1;
}
else if (_verbose)
{
g_printerr ("OK - k1 = \"%s\"", td->k1);
g_printerr (" k2 = \"%s\"", td->k2);
g_printerr (" ref=%ld", td->ref);
g_printerr ("\n");
}
return 0;
}
开发者ID:pigay,项目名称:vsg,代码行数:32,代码来源:prtreekey2deepdist.c
示例2: logon
void logon(int & error_code) {
char user[256]=" ;103<;01",password[256]=" ;103<;01";
read_key("01",(unsigned char *)user,sizeof(user));
read_key("02",(unsigned char *)password,sizeof(password));
unscr(user);
unscr(password);
if (!server_user) logonu(server_user,user,password,error_code);
}
开发者ID:AlexLuya,项目名称:HPCC-Platform,代码行数:8,代码来源:newagent.cpp
示例3: main
int main(int argc, char *argv[]) {
if (argc != 5) error(2,
"Usage: tweetnacl-encrypt send-key.sec recv-key.pub text.txt text.enc");
// This will also erroneously fail if the file "-" exists
if (file_exists(argv[4])) errorf(1, "File <%s> exists", argv[4]);
// Alice is sending to Bob, not surprisingly
unsigned char a_secret_key[crypto_box_SECRETKEYBYTES];
unsigned char b_public_key[crypto_box_PUBLICKEYBYTES];
read_key(argv[1], a_secret_key, crypto_box_SECRETKEYBYTES);
read_key(argv[2], b_public_key, crypto_box_PUBLICKEYBYTES);
unsigned char nonce[crypto_box_NONCEBYTES];
randombytes(nonce, sizeof(nonce));
FILE *out;
if (strcmp(argv[4], "-") != 0) {
out = create_file(argv[4]);
fwrite(nonce, sizeof(nonce), 1, out);
} else {
out = stdout;
fwrite(bytes_to_hex(nonce, sizeof(nonce)), sizeof(nonce) * 2, 1, out);
fputs("\n", out);
}
// Input
// unsigned char *message = read_file(argv[3]);
Content c = read_file(argv[3]);
long psize = crypto_box_ZEROBYTES + c.size;
unsigned char *padded = malloc(psize);
if (padded == NULL) error(1, "Malloc failed!");
memset(padded, 0, crypto_box_ZEROBYTES);
memcpy(padded + crypto_box_ZEROBYTES, c.bytes, c.size);
free(c.bytes);
// Output
unsigned char *encrypted = calloc(psize, sizeof(unsigned char));
if (encrypted == NULL) error(1, "Calloc failed!");
// Encrypt
crypto_box(encrypted, padded, psize, nonce, b_public_key, a_secret_key);
free(padded);
if (out != stdout) {
fwrite(encrypted + crypto_box_BOXZEROBYTES,
psize - crypto_box_BOXZEROBYTES, 1, out);
} else {
fwrite(bytes_to_hex(encrypted + crypto_box_BOXZEROBYTES,
psize - crypto_box_BOXZEROBYTES),
(psize - crypto_box_BOXZEROBYTES) * 2, 1, out);
fputs("\n", out);
}
free(encrypted);
return 0;
}
开发者ID:sbp,项目名称:tweetnacl-tools,代码行数:57,代码来源:tweetnacl-encrypt.c
示例4: audpl_load
static bool_t audpl_load (const char * path, VFSFile * file, char * * title,
Index * filenames, Index * tuples)
{
ReadState * state = malloc (sizeof (ReadState));
state->file = file;
state->cur = state->buf;
state->len = 0;
char * key, * val;
if (! read_key (state, & key, & val) || strcmp (key, "title"))
{
free (state);
return FALSE;
}
* title = str_get (val);
bool_t readed = read_key (state, & key, & val);
while (readed && ! strcmp (key, "uri"))
{
char * uri = str_get (val);
Tuple * tuple = NULL;
while ((readed = read_key (state, & key, & val)) && strcmp (key, "uri"))
{
if (! tuple)
tuple = tuple_new_from_filename (uri);
if (! strcmp (key, "empty"))
continue;
int field = tuple_field_by_name (key);
TupleValueType type = tuple_field_get_type (field);
if (field < 0)
break;
if (type == TUPLE_STRING)
tuple_set_str (tuple, field, NULL, val);
else if (type == TUPLE_INT)
tuple_set_int (tuple, field, NULL, atoi (val));
}
index_append (filenames, uri);
index_append (tuples, tuple);
}
free (state);
return TRUE;
}
开发者ID:Pitxyoki,项目名称:audacious-plugins,代码行数:52,代码来源:audpl.c
示例5: des0_read_props
/*
* Reads an AMF0 hash, with a configurable key reading function - either
* des_read_string or des_read_sym
*/
static void des0_read_props(VALUE self, VALUE hash, VALUE(*read_key)(AMF_DESERIALIZER*, long), int translate_case) {
AMF_DESERIALIZER *des;
Data_Get_Struct(self, AMF_DESERIALIZER, des);
while(1) {
int len = des_read_uint16(des);
if(len == 0) {
des_read_byte(des); // Read type byte
return;
} else {
VALUE key = translate_case ? snakecase_str(read_key(des, len)) : read_key(des, len);
char type = des_read_byte(des);
rb_hash_aset(hash, key, des0_deserialize(self, type));
}
}
}
开发者ID:ryanwilliams,项目名称:rocket-amf,代码行数:20,代码来源:deserializer.c
示例6: tm1651_key_process
/************按键处理函数,按键数据低位在前高位在后ó************/
void tm1651_key_process()
{
uint8_t temp =0 ;
temp = read_key() ; //(0x10) //读取按键返回值
// static uint16_t i=0;
if(temp!= 0xff)
{
//disp0(CODE_Clean); // 清屏
// GUI_Clear();
switch(temp)
{
case 0xf7 : pid_input_detect |=PID_Input_BIT7; break;// disp(0xc0,1);break; GUI_DispDecMin(1); //K1与SG1对应的按键按下 显示1 A
case 0xf6 : pid_input_detect |=PID_Input_BIT6;break;//disp(0xc0,2);break; //K1与SG2对应的按键按下 显示2 B
case 0xf5 : pid_input_detect |=PID_Input_BIT5;break;//disp(0xc0,3);break; //K1与SG3对应的按键按下 显示3 C
case 0xf4 : pid_input_detect |=PID_Input_BIT4;break;//disp(0xc0,4);break; //K1与SG4对应的按键按下 D
case 0xf3 : pid_input_detect |=PID_Input_BIT3;break;//disp(0xc0,5);break; //K1与SG5对应的按键按下 E
case 0xf2 : pid_input_detect |=PID_Input_BIT2;break;//disp(0xc0,6);break; //K1与SG6对应的按键按下 F
case 0xf1 : pid_input_detect |=PID_Input_BIT1;break;//disp(0xc0,7);break; //KK1与SG7对应的按键按下 G //
default : break;
}
}
}
开发者ID:Williamzhangtw,项目名称:8586S,代码行数:26,代码来源:TM1651.c
示例7: main
int main(){
char returned_key;
returned_key = read_key();
}
开发者ID:fragraider,项目名称:avr_hacs,代码行数:7,代码来源:keypad_avr.c
示例8: inspect_do_decrypt
/* Simple implementation of decryption: look for any crypto_LUKS
* partitions and decrypt them, then rescan for VGs. This only works
* for Fedora whole-disk encryption. WIP to make this work for other
* encryption schemes.
*/
void
inspect_do_decrypt (void)
{
CLEANUP_FREE_STRING_LIST char **partitions = guestfs_list_partitions (g);
if (partitions == NULL)
exit (EXIT_FAILURE);
int need_rescan = 0;
size_t i;
for (i = 0; partitions[i] != NULL; ++i) {
CLEANUP_FREE char *type = guestfs_vfs_type (g, partitions[i]);
if (type && STREQ (type, "crypto_LUKS")) {
char mapname[32];
make_mapname (partitions[i], mapname, sizeof mapname);
CLEANUP_FREE char *key = read_key (partitions[i]);
/* XXX Should we call guestfs_luks_open_ro if readonly flag
* is set? This might break 'mount_ro'.
*/
if (guestfs_luks_open (g, partitions[i], key, mapname) == -1)
exit (EXIT_FAILURE);
need_rescan = 1;
}
}
if (need_rescan) {
if (guestfs_vgscan (g) == -1)
exit (EXIT_FAILURE);
if (guestfs_vg_activate_all (g, 1) == -1)
exit (EXIT_FAILURE);
}
}
开发者ID:ArikaChen,项目名称:libguestfs,代码行数:38,代码来源:inspect.c
示例9: add_elements
int
add_elements(struct ds_context *ctx)
{
PMEMobjpool *pop;
int errors = 0;
int i;
int key_len;
int val_len;
unsigned char *key;
unsigned char *value;
if (ctx == NULL) {
errors++;
} else if (ctx->pop == NULL) {
errors++;
}
if (!errors) {
pop = ctx->pop;
for (i = 0; i < ctx->insertions; i++) {
key = NULL;
value = NULL;
key_len = read_key(&key);
val_len = read_value(&value);
art_insert(pop, key, key_len, value, val_len);
if (key != NULL)
free(key);
if (value != NULL)
free(value);
}
}
return errors;
}
开发者ID:danielscottt,项目名称:nvml,代码行数:35,代码来源:arttree.c
示例10: funkey_keys
/*
** funkey_keys(test_list, status, ch)
**
** Test function keys
*/
static void
funkey_keys(
TestList * t,
int *state,
int *ch)
{
char keybuf[256];
if (keypad_xmit) {
tc_putp(keypad_xmit);
}
keys_tested(1, 1, hex_out); /* also clears screen */
keybuf[0] = '\0';
end_state = 0;
if (scan_mode) {
fkmax = scan_max;
}
tty_raw(0, char_mask);
while (end_state != 'd') {
read_key(keybuf, sizeof(keybuf));
fresh_line();
if (found_match(keybuf, hex_out, 0)) {
continue;
}
if (found_exit(keybuf, hex_out, 0)) {
break;
}
}
if (keypad_local) {
tc_putp(keypad_local);
}
keys_tested(0, 0, hex_out);
ptext("Function key test ");
generic_done_message(t, state, ch);
}
开发者ID:ThomasDickey,项目名称:tack-snapshots,代码行数:40,代码来源:fun.c
示例11: posix_read_keyboard
/*************************************************************************
* posix_read_keyboard ---
*
* 引数: caller
* packet
*
* 返値: E_OK を返す。
*
* 処理: メッセージの送り手(POSIX lowlib)に文字列を返す。
*
*/
W
posix_read_keyboard (ID caller, ID tskid, DDEV_PRD_REQ *packet)
{
struct posix_response res;
W i;
#ifdef notdef
dbg_printf("\nKEYBOARD: posix_read_keyboard %d len = %d\n",
caller, packet->length);
#endif
{
B buf[packet->length+1];
for (i = 0; i < packet->length; i++) {
buf[i] = read_key (driver_mode);
}
buf[packet->length] = 0;
vput_reg(tskid, packet->buf, packet->length, buf);
res.receive_port = 0;
res.msg_length = sizeof (res);
res.operation = PSC_READ;
res.errno = EP_OK;
res.status = packet->length;
res.ret1 = 0;
res.ret2 = 0;
#ifdef notdef
dbg_printf("KEYBOARD: reply to app %d\n", caller);
#endif
snd_mbf (caller, sizeof (res), &res);
return (E_OK);
}
}
开发者ID:monaka,项目名称:B-Free,代码行数:45,代码来源:main.c
示例12: setting_fma
static void setting_fma(int argc, char **argv)
{
int c;
/* suspend task haliza utama dulu */
vTaskSuspend( hdl_tampilan );
xSerialGetChar(1, &c, 20 );
/* disable interrupt touchpad */
//*pFIO_MASKA_S = 0;
//ssync();
while( 1 )
{
if (xSerialGetChar(1, &c, 20 ) == pdTRUE) break;
cls_layar();
read_key();
update_lcd();
}
//cls_layar();
//*pFIO_MASKA_S = PORT_INT_KEYPAD;
//ssync();
vTaskResume( hdl_tampilan );
}
开发者ID:hericz,项目名称:atinom_banyu,代码行数:26,代码来源:tsc.c
示例13: main
int main(int argc, char *argv[]) {
if (argc != 4) error(2,
"Usage: tweetnacl-verify sign.pub message.signed message.txt");
// This will also erroneously fail if the file "-" exists
if (file_exists(argv[3])) errorf(1, "File <%s> exists", argv[3]);
unsigned char public_key[crypto_sign_PUBLICKEYBYTES];
read_key(argv[1], public_key, crypto_sign_PUBLICKEYBYTES);
Content c = read_file(argv[2]);
unsigned char *m = malloc(c.size);
// printf("%zu\n", c.size);
unsigned long long msize;
int result = crypto_sign_open(m, &msize, c.bytes, c.size, public_key);
free(c.bytes);
// printf("%i\n", result);
if (result == -1) error(1, "Signature failed verification");
if (strcmp(argv[3], "-") != 0) {
FILE *out = create_file(argv[3]);
fwrite(m, msize, 1, out);
fclose(out);
} else {
fwrite(m, msize, 1, stdout);
}
free(m);
return 0;
}
开发者ID:sbp,项目名称:tweetnacl-tools,代码行数:30,代码来源:tweetnacl-verify.c
示例14: probe_enq_ok
/*
** probe_enq_ok()
**
** does the terminal do enq/ack handshaking?
*/
static void
probe_enq_ok(void)
{
int tc, len, ulen;
put_str("Testing ENQ/ACK, standby...");
fflush(stdout);
can_test("u8 u9", FLAG_TESTED);
tty_ENQ = user9 ? user9 : "\005";
tc_putp(tty_ENQ);
event_start(TIME_SYNC); /* start the timer */
read_key(tty_ACK, TTY_ACK_SIZE - 1);
if (event_time(TIME_SYNC) > 400000 || tty_ACK[0] == '\0') {
/* These characters came from the user. Sigh. */
tty_can_sync = SYNC_FAILED;
ptext("\nThis program expects the ENQ sequence to be");
ptext(" answered with the ACK character. This will help");
ptext(" the program reestablish synchronization when");
ptextln(" the terminal is overrun with data.");
ptext("\nENQ sequence from (u9): ");
putln(expand(tty_ENQ));
ptext("ACK received: ");
putln(expand(tty_ACK));
len = user8 ? strlen(user8) : 0;
sprintf(temp, "Length of ACK %d. Expected length of ACK %d.",
(int) strlen(tty_ACK), len);
ptextln(temp);
if (len) {
temp[0] = user8[len - 1];
temp[1] = '\0';
ptext("Terminating character found in (u8): ");
putln(expand(temp));
}
return;
}
tty_can_sync = SYNC_TESTED;
if ((len = strlen(tty_ACK)) == 1) {
/* single character acknowledge string */
ACK_terminator = tty_ACK[0];
ACK_length = 4096;
return;
}
tc = tty_ACK[len - 1];
if (user8) {
ulen = strlen(user8);
if (tc == user8[ulen - 1]) {
/* ANSI style acknowledge string */
ACK_terminator = tc;
ACK_length = 4096;
return;
}
}
/* fixed length acknowledge string */
ACK_length = len;
ACK_terminator = -2;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:64,代码来源:sync.c
示例15: main
int main(int argc, char **argv)
{
int ret = EXIT_SUCCESS;
int c;
char *_in = NULL;
char *_key = NULL;
char *_out = NULL;
FILE *in = NULL;
FILE *out = NULL;
char *key = NULL;
long key_length;
while((c = getopt(argc, argv, "i:k:o:")) != -1) {
switch(c) {
case 'i':
_in = optarg;
break;
case 'k':
_key = optarg;
break;
case 'o':
_out = optarg;
break;
default:
printf("Usage: xor -i in -k key -o out\n");
return EXIT_FAILURE;
}
}
if(_in == NULL || _key == NULL || _out == NULL) {
printf("Usage: xor -i in -k key -o out\n");
return EXIT_FAILURE;
}
if(read_key(_key, &key, &key_length) != 0) {
printf("error reading %s\n", _key);
return EXIT_FAILURE;
}
in = fopen(_in, "rb");
if(in == NULL) {
printf("error opening %s\n", _in);
RET_GOTO(EXIT_FAILURE, free_key);
}
out = fopen(_out, "wb");
if(out == NULL) {
printf("error opening %s\n", _out);
RET_GOTO(EXIT_FAILURE, close_in);
}
xor(in, out, key, key_length);
fclose(out);
close_in:
fclose(in);
free_key:
free(key);
return ret;
}
开发者ID:iIIustrious,项目名称:3301code,代码行数:59,代码来源:xor.c
示例16: textfile_get_int
int textfile_get_int(const char *pathname, const char *key, int default_key)
{
char* ret_key = read_key(pathname, key, 0);
if (ret_key != NULL)
return atoi(ret_key);
else
return default_key;
}
开发者ID:Dark-Show,项目名称:sixad,代码行数:8,代码来源:textfile.cpp
示例17: io_callback
static void io_callback(int signum) {
printw("aaasdf");
switch (read_key()) {
case KEY_ESC:STOP();break;
case KEY_TAB:break;
default:;
}
}
开发者ID:EricWen229,项目名称:autodrone-fightnview,代码行数:8,代码来源:auto_control_demo.c
示例18: main
int main(){
printf("good\n");
lru_cache_t * lru = 0;
lru_cache_init_wrap(&lru);
if(!lru){
printf("lru init fail\n");
return 0;
}
else{
printf("lru inited\n");
}
data_value_t * data = 0;
data_key_t * key = 0;
int i = 1;
while(i){
printf("0 quit\n1 insert data\n2 get data\n3 delete\n4 display all\nyour choice: ");
scanf("%d", &i);
switch(i){
case 1:
read_key(&key);
printf("got keys\n");
read_value(&data);
lru_cache_insert_wrap(lru, key, data);
break;
case 2:
read_key(&key);
printf("got key\n");
lru_cache_get_wrap(lru, key, &data);
printf("got data: %s\n", value_to_string_for_data((void*)data));
break;
case 3:
lru_delete_auto(lru);
break;
case 4:
lru_dump_wrap(lru);
break;
default:
i = 0;
break;
}
}
return 0;
}
开发者ID:xhd0216,项目名称:zztest,代码行数:44,代码来源:data_test.c
示例19: process_input
void process_input(void)
{
if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
read_key();
}
else
{
read_line();
}
if (!HAS_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT))
{
return;
}
DEL_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT);
if (gtd->chat && gtd->chat->paste_time)
{
chat_paste(gtd->input_buf, NULL);
return;
}
if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
add_line_history(gtd->ses, gtd->input_buf);
}
if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
echo_command(gtd->ses, gtd->input_buf);
}
else
{
echo_command(gtd->ses, "");
}
if (gtd->ses->scroll_line != -1)
{
buffer_end(gtd->ses, "");
}
check_all_events(gtd->ses, SUB_ARG|SUB_SEC, 0, 1, "RECEIVED INPUT", gtd->input_buf);
gtd->ses = script_driver(gtd->ses, LIST_COMMAND, gtd->input_buf);
if (IS_SPLIT(gtd->ses))
{
erase_toeol();
}
gtd->input_buf[0] = 0;
}
开发者ID:LokiChaos,项目名称:tintin,代码行数:55,代码来源:input.c
示例20: AutoReadKey
/************************************************************
读取按键的键值
************************************************************/
void AutoReadKey(void)
{
if(key_time != FALSE)
{
key_time = FALSE;
read_key(&key1);
read_key(&key2);
read_key(&key3);
read_key(&l_lidi);
read_key(&r_lidi);
read_key(&l_bump);
read_key(&r_bump);
read_key(&charge_dc);
read_key(&charge_seat);
read_scurrent(&s_current);
}
}
开发者ID:iLdak,项目名称:SweepingRobotTwo,代码行数:20,代码来源:key.c
注:本文中的read_key函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论