Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- char *read_command(char *command) {
- FILE *fp;
- char *output;
- output = malloc(10);
- fp = popen(command, "r");
- if (fp == NULL) {
- exit(1);
- } else {
- fscanf(fp, "%s", output);
- }
- pclose(fp);
- return output;
- }
- int main() {
- char *out;
- out = read_command("xdotool getwindowname $(xdotool getactivewindow)");
- printf("Active Window => %s\n", out);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement