通知发送C代码
如何使用存储在字符串中的消息从C代码调用notify send通知发送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
#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;
}