本文整理汇总了C++中print_message函数的典型用法代码示例。如果您正苦于以下问题:C++ print_message函数的具体用法?C++ print_message怎么用?C++ print_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_message函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_yaffs_read_EINVAL
int test_yaffs_read_EINVAL(void)
{
int error_code = 0;
handle=yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE);
char text[2000000];
int output=0;
if (handle<0){
print_message("could not open file\n",2);
return -1;
}
/*there needs a large amout of test in the file in order to trigger EINVAL */
output=test_yaffs_read_EINVAL_init();
if (output<0){
print_message("could not write text to the file\n",2);
return -1;
}
if (handle>=0){
output=yaffs_read(handle, text, -1);
if (output<0){
error_code=yaffs_get_error();
if (abs(error_code)== EINVAL){
return 1;
} else {
print_message("different error than expected\n",2);
return -1;
}
} else{
print_message("read a negative number of bytes (which is a bad thing)\n",2);
return -1;
}
} else {
print_message("error opening file\n",2);
return -1;
}
}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:38,代码来源:test_yaffs_read_EINVAL.c
示例2: prep2_cb
int
prep2_cb(tse_task_t *task, void *data)
{
int *verify_cnt = *((int **)data);
print_message("Prep2 CB: counter = %d\n", *verify_cnt);
if (*verify_cnt != 1) {
print_error("Failed verification of prep cb ordering\n");
return -1;
}
*verify_cnt = *verify_cnt + 1;
return 0;
}
开发者ID:daos-stack,项目名称:daos,代码行数:14,代码来源:sched.c
示例3: exportData
void exportData( const char *filename ,
const std::vector<double> & v1 )
{
int max = v1.size();
std::ofstream os;
os.open(filename);
if(!os.good()) {
print_message("could not open output file.");
print_message(filename);
exit(1);
}
print_message("Exporting data:");
os << "//Data values" << '\n';
for (int i = 0; i < max; i++ ) os << v1[i] << '\n';
}
开发者ID:andres0sorio,项目名称:CMSWork,代码行数:23,代码来源:Utilities.C
示例4: proc_led
int proc_led( int argc, char *argv[], byte first_param )
{
if (argc < (first_param+1)) {
printf( "No instance parameter.\n");
return 0;
}
byte instance = atoi(argv[first_param+1]);
printf("SYSTEM LEDS... instance=%d\n", instance );
if (argc < (first_param+2)) {
printf( "No LED mode parameter.\n");
return 0;
}
if (strcmp(argv[first_param+2], "device") == 0) {
printf("Device\n");
pack_system_led( &msg1, instance, SYSTEM_LED_MODE_DEVICE, 0 );
}
if (strcmp(argv[first_param+2], "myInstance") == 0) {
printf("Strobing\n");
pack_system_led( &msg1, instance, SYSTEM_LED_MODE_MYINSTANCE, 0 );
}
else if (strcmp(argv[first_param+2], "strobe") == 0)
{
if (argc < (first_param+3)) {
printf( "No LED on/off parameter.\n");
return 0;
}
byte value;
if (strcmp(argv[first_param+3], "on") == 0)
value = 1;
else if (strcmp(argv[first_param+3], "off") == 0)
value = 0;
else
value = atoi( argv[first_param+3] );
pack_system_led( &msg1, instance, SYSTEM_LED_MODE_STROBE, value );
}
else if (strcmp(argv[first_param+2], "pattern") == 0)
{
if (argc < (first_param+3)) {
printf( "No LED pattern parameter.\n");
return 0;
}
printf("pattern: id=%d", ID_SYSTEM_LED_REQUEST );
byte pattern = atoi( argv[first_param+3] );
pack_system_led( &msg1, instance, SYSTEM_LED_MODE_PATTERN, pattern );
print_message(&msg1);
}
AddToSendList( &msg1 );
return 1;
}
开发者ID:stenniswood,项目名称:bk_code,代码行数:50,代码来源:cmd_process.c
示例5: test_yaffs_rename_file_over_file
int test_yaffs_rename_file_over_file(void)
{
int output=0;
int error_code =0;
if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1) {
print_message("failed to create file\n",1);
return -1;
}
if (yaffs_close(yaffs_open(FILE_PATH2,O_CREAT | O_RDWR, FILE_MODE))==-1) {
print_message("failed to create file\n",1);
return -1;
}
output = yaffs_rename(FILE_PATH ,FILE_PATH2 );
if (output<0) {
print_message("could not rename a file over a file (which is a bad thing)\n",2);
return -1;
}
return 1;
}
开发者ID:daydaygit,项目名称:smdk6410_version2fl,代码行数:23,代码来源:test_yaffs_rename_file_over_file.c
示例6: test_yaffs_access_NULL
int test_yaffs_access_NULL(void)
{
int output=0;
int error=0;
if (set_up_ELOOP()<0){
print_message("failed to setup symlinks\n",2);
return -1;
}
output= yaffs_access(NULL,0);
if (output<0){
error=yaffs_get_error();
if ( abs(error)== EFAULT){
return 1;
} else {
print_message("error does not match expected error\n",2);
return -1;
}
} else{
print_message("accessed an existing file with bad mode (which is a bad thing\n",2);
return -1;
}
}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:23,代码来源:test_yaffs_access_NULL.c
示例7: test_yaffs_mkdir_ELOOP_dir
int test_yaffs_mkdir_ELOOP_dir(void)
{
int error_code = 0;
if (set_up_ELOOP()<0){
print_message("failed to setup symlinks\n",2);
return -1;
}
output = yaffs_mkdir(ELOOP_PATH "/file",O_CREAT | O_RDWR);
if (output < 0){
error_code = yaffs_get_error();
if (abs(error_code) == ELOOP){
return 1;
} else {
print_message("different error than expected\n", 2);
return -1;
}
} else {
print_message("created a new directory on top of an non-existing directory (which is a bad thing)\n", 2);
return -1;
}
}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:23,代码来源:test_yaffs_mkdir_ELOOP_dir.c
示例8: torture_path_expand_tilde_win
static void torture_path_expand_tilde_win(void **state) {
char *d;
(void) state;
d = ssh_path_expand_tilde("~\\.ssh");
assert_false(d == NULL);
print_message("Expanded path: %s\n", d);
free(d);
d = ssh_path_expand_tilde("/guru/meditation");
assert_string_equal(d, "/guru/meditation");
free(d);
}
开发者ID:FuckingCoder,项目名称:libssh,代码行数:14,代码来源:torture_misc.c
示例9: XferToRam
/******************************
Routine:
Description:
******************************/
void XferToRam(void)
{
unsigned int temp;
void (*entry_point) (void);
cons_hook();
print_message("Copying image from Flash to Ram.\n");
for (temp = 0; temp < (0x100000 - 0x20000); temp = temp + 4) {
*(volatile unsigned int *) (temp + 0xa0400000) =
*(volatile unsigned int *) (temp + srcAddr);
if (*(volatile unsigned int *) (temp + 0xa0400000) !=
*(volatile unsigned int *) (temp + srcAddr)) {
print_message
("Error!: copy verification failed.\n");
break;
}
}
print_message("Now jumping to the code just xferred to ram.\n");
entry_point = (void *) 0x80400000;
entry_point();
}
开发者ID:TKr,项目名称:Wive-ng-rt8186,代码行数:27,代码来源:xfer.c
示例10: play_press
void play_press()
{
struct disc_status status;
if(!disc_present)
return;
cd_poll(cd_fd, &status);
switch(status.status_mode) {
case CDAUDIO_PLAYING:
print_message("Paused");
break;
case CDAUDIO_PAUSED:
print_message("Resuming");
break;
default:
if(valid_cddb)
printf_message("Playing track %d: %s", play_track, data.data_track[play_track - 1].track_name);
else
printf_message("Playing track %d", play_track);
}
}
开发者ID:tarcieri,项目名称:gdcd,代码行数:23,代码来源:cdfunction.c
示例11: install_service
/* Install the service */
int install_service(char *name, char *exe, char *flags) {
/* Open service manager */
SC_HANDLE services = open_service_manager();
if (! services) {
print_message(stderr, NSSM_MESSAGE_OPEN_SERVICE_MANAGER_FAILED);
return 2;
}
/* Get path of this program */
char path[MAX_PATH];
GetModuleFileName(0, path, MAX_PATH);
/* Construct command */
char command[CMD_LENGTH];
size_t pathlen = strlen(path);
if (pathlen + 1 >= VALUE_LENGTH) {
print_message(stderr, NSSM_MESSAGE_PATH_TOO_LONG, NSSM);
return 3;
}
if (_snprintf(command, sizeof(command), "\"%s\"", path) < 0) {
print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY_FOR_IMAGEPATH);
return 4;
}
/* Work out directory name */
size_t len = strlen(exe);
size_t i;
for (i = len; i && exe[i] != '\\' && exe[i] != '/'; i--);
char dir[MAX_PATH];
memmove(dir, exe, i);
dir[i] = '\0';
/* Create the service */
SC_HANDLE service = CreateService(services, name, name, SC_MANAGER_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, command, 0, 0, 0, 0, 0);
if (! service) {
print_message(stderr, NSSM_MESSAGE_CREATESERVICE_FAILED);
CloseServiceHandle(services);
return 5;
}
/* Now we need to put the parameters into the registry */
if (create_parameters(name, exe, flags, dir)) {
print_message(stderr, NSSM_MESSAGE_CREATE_PARAMETERS_FAILED);
DeleteService(service);
CloseServiceHandle(services);
return 6;
}
set_service_recovery(service, name);
/* Cleanup */
CloseServiceHandle(service);
CloseServiceHandle(services);
print_message(stdout, NSSM_MESSAGE_SERVICE_INSTALLED, name);
return 0;
}
开发者ID:davnight,项目名称:homidom,代码行数:58,代码来源:service.cpp
示例12: do_wait
static waitres_t
do_wait(ptrace_context *ctx, bool blocked)
{
int status, ret;
do {
ret = waitpid(ctx->pid, &status, blocked ? 0 : WNOHANG);
if (ret == 0)
return WR_NOTHING;
if (ret == -1 && errno != EINTR)
err(2, "waitpid failed");
} while(ret < 0);
assert(ret == ctx->pid) ;
assert(!WIFCONTINUED(status));
if (WIFEXITED(status)) {
print_message("Traced process (%d) exited with code %d", ctx->pid, WEXITSTATUS(status));
return WR_FINISHED;
}
if (WIFSIGNALED(status)) {
print_message("Traced process (%d) terminated by signal %d (%s)", ctx->pid,
WTERMSIG(status), strsignal(WTERMSIG(status)));
return WR_FINISHED;
}
assert(WIFSTOPPED(status));
ctx->stop_signal = WSTOPSIG(status);
if (ctx->stop_signal == SIGTSTP ||
ctx->stop_signal == SIGTTIN || ctx->stop_signal == SIGTTOU) {
return WR_NEED_DETACH;
}
return WR_STOPPED;
}
开发者ID:KurSh,项目名称:crxprof,代码行数:37,代码来源:main.c
示例13: readData
void readData(const char *source,
std::vector<double> &v1,
std::vector<double> &v2,
std::vector<double> &v3)
{
v1.clear();
v2.clear();
v3.clear();
ifstream in;
in.open(source);
if(!in) {
print_message("could not open input file.");
print_message(source);
exit(1);
}
print_message("opening files:");
char comment[256];
in.getline (comment,256);
print_message(comment);
while (1) {
double x(0.), y(0.), z(0.);
in >> x >> y >> z;
if (!in.good()) break;
v1.push_back(x);
v2.push_back(y);
v3.push_back(z);
}
in.close();
}
开发者ID:andres0sorio,项目名称:CMSWork,代码行数:37,代码来源:Utilities.C
示例14: getListOfFiles
void getListOfFiles(const char *source, TList *fileNames,
std::vector<double> &v1, std::vector<double> &v2)
{
gROOT->Reset();
ifstream in;
in.open(source);
if(!in) {
print_message("could not open input file.");
print_message(source);
exit(1);
}
print_message("opening files:");
char comment[256];
in.getline (comment,256);
print_message(comment);
while (1) {
char str[60];
double x1(0.);
double x2(0.);
in >> str >> x1 >> x2;
if (!in.good()) break;
TString name(str);
print_message(name.Data());
fileNames->Add( TFile::Open(name.Data()) );
v1.push_back(x1);
v2.push_back(x2);
}
in.close();
}
开发者ID:andres0sorio,项目名称:CMSWork,代码行数:37,代码来源:Utilities.C
示例15: test_yaffs_read_EINVAL_init
int test_yaffs_read_EINVAL_init(void)
{
int output=0;
int x=0;
int file_name_length=1000000;
file_name = malloc(file_name_length);
if(!file_name){
print_message("unable to create file text\n",2);
return -1;
}
strcpy(file_name,YAFFS_MOUNT_POINT);
for (x=strlen(YAFFS_MOUNT_POINT); x<file_name_length -1; x++){
file_name[x]='a';
}
file_name[file_name_length-2]='\0';
if (handle>=0){
output= yaffs_write(handle, file_name, file_name_length-1);
if (output<0){
print_message("could not write text to file\n",2);
return -1;
} else {
return 1;
}
} else {
print_message("error opening file\n",2);
return -1;
}
}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:37,代码来源:test_yaffs_read_EINVAL.c
示例16: torture_channel_read_error
static void torture_channel_read_error(void **state) {
ssh_session session = *state;
char *user = getenv("TORTURE_USER");
ssh_channel channel;
int rc;
int i;
if (user == NULL) {
print_message("*** Please set the environment variable TORTURE_USER"
" to enable this test!!\n");
return;
}
rc = ssh_options_set(session, SSH_OPTIONS_USER, user);
assert_true(rc == SSH_OK);
rc = ssh_connect(session);
assert_true(rc == SSH_OK);
rc = ssh_userauth_none(session,NULL);
/* This request should return a SSH_REQUEST_DENIED error */
if (rc == SSH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_PUBLICKEY);
rc = ssh_userauth_autopubkey(session, NULL);
assert_true(rc == SSH_AUTH_SUCCESS);
channel = ssh_channel_new(session);
assert_true(channel != NULL);
rc = ssh_channel_open_session(channel);
assert_true(rc == SSH_OK);
rc = ssh_channel_request_exec(channel, "hexdump -C /dev/urandom");
assert_true(rc == SSH_OK);
/* send crap and for server to send us a disconnect */
rc = write(ssh_get_fd(session),"AAAA", 4);
assert_int_equal(rc, 4);
for (i=0;i<20;++i){
rc = ssh_channel_read(channel,buffer,sizeof(buffer),0);
if (rc == SSH_ERROR)
break;
}
assert_true(rc == SSH_ERROR);
}
开发者ID:AudriusButkevicius,项目名称:node-libssh,代码行数:49,代码来源:torture_session.c
示例17: listener
void listener(const orb_id_t &id, unsigned num_msgs, unsigned topic_instance, unsigned topic_interval)
{
if (orb_exists(id, topic_instance) != 0) {
printf("never published\n");
return;
}
int sub = orb_subscribe_multi(id, topic_instance);
orb_set_interval(sub, topic_interval);
bool updated = false;
unsigned i = 0;
hrt_abstime start_time = hrt_absolute_time();
while (i < num_msgs) {
orb_check(sub, &updated);
if (i == 0) {
updated = true;
} else {
usleep(500);
}
if (updated) {
start_time = hrt_absolute_time();
i++;
printf("\nTOPIC: %s instance %d #%d\n", id->o_name, topic_instance, i);
T container;
if (orb_copy(id, sub, &container) == PX4_OK) {
print_message(container);
} else {
PX4_ERR("orb_copy failed");
}
} else {
if (hrt_elapsed_time(&start_time) > 2 * 1000 * 1000) {
printf("Waited for 2 seconds without a message. Giving up.\n");
break;
}
}
}
orb_unsubscribe(sub);
}
开发者ID:ayu135,项目名称:Firmware,代码行数:49,代码来源:topic_listener.hpp
示例18: sendData
void sendData(ENC_ctx *ENC_ctx_sender, const unsigned char *input, const unsigned int input_size, message_ctx *ciphermessage)
{ if (PRINT_inputs_outputs){
printf("\n-->Encrypt: %s\n", input);
print_hex_memory(input, input_size);
printf("\n");
}
CCM_encrypt(ciphermessage, ENC_ctx_sender, input, input_size);
ciphermessage->tag=0xFF;
if (PRINT_messages){
print_message(ciphermessage);
printf("\n");
}
}
开发者ID:SepOwnage,项目名称:P-O5,代码行数:15,代码来源:cryptoMain.c
示例19: test_yaffs_rename_dir
int test_yaffs_rename_dir(void)
{
int output=0;
if (0 != yaffs_access(DIR_PATH,0)) {
output = yaffs_mkdir(DIR_PATH,S_IREAD|S_IWRITE);
if (output < 0) {
print_message("failed to create file\n",2);
return -1;
}
}
output = yaffs_rename( DIR_PATH , RENAME_DIR_PATH);
return output;
}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:15,代码来源:test_yaffs_rename_dir.c
示例20: client
/* Client function
Randomly chooses a port
Randomly chooses a server port
Sends message from that port
Waits for reply on that port
Recieves the messae and prints it
Then chooses another port
*/
void client(){
int my_port;
int server_port = (rand() % 2 == 1) ? SERVER_PORT1 : SERVER_PORT0;
struct message *rec_message;
rec_message = (struct message*)malloc(sizeof(struct message));
while(1) {
my_port = rand() % 98;
printf("\nClient Port [%d] : Sending Message to %d\n", my_port, server_port);
send(server_port, my_port);
rec_message = receive(my_port);
printf("\nClient Port [%d] : Recieving Message from %d\n", my_port, server_port);
print_message(rec_message);
sleep(1);
}
}
开发者ID:lpanchma,项目名称:DMOS,代码行数:23,代码来源:msgs_test.c
注:本文中的print_message函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论