Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通知发送C代码_C_Popup - Fatal编程技术网

通知发送C代码

通知发送C代码,c,popup,C,Popup,如何使用存储在字符串中的消息从C代码调用notify send #include <stdlib.h> int main(int argc, char *argv[]) { system("mount something somewhere"); system("notify-send message"); return 0; } 只需将字符串作为参数发送到系统 例如: #include <stdlib.h> #include <string

如何使用存储在字符串中的消息从C代码调用notify send

#include <stdlib.h>

int main(int argc, char *argv[]) 
{
   system("mount something somewhere");
   system("notify-send message");
   return 0;
}

只需将字符串作为参数发送到系统

例如:

#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[]) 
{
    char command[100], msg[100];

    strcpy(command,"notify-send ");
    strcpy(msg,"\"Hello World\"");
    strcat(command,msg);

    system(command);
    return 0; 
}

如果此代码不适用于您,请确保在命令行中使用notify send命令work。如果该命令在甚至命令行中都不起作用,请尝试先安装它sudo apt get install notify osd
#include <stdio.h>

int main(void)
{
    system("notify-send Test \"Hello World\"");
    return 0;
}