forked from wtr9987/gvtree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute_cmd.cpp
More file actions
39 lines (34 loc) · 1.23 KB
/
execute_cmd.cpp
File metadata and controls
39 lines (34 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* --------------------------------------------- */
/* */
/* Copyright (C) 2021 Wolfgang Trummer */
/* Contact: wolfgang.trummer@t-online.de */
/* */
/* gvtree V1.8-0 */
/* */
/* git version tree browser */
/* */
/* 28. December 2021 */
/* */
/* This program is licensed under */
/* GNU GENERAL PUBLIC LICENSE */
/* Version 3, 29 June 2007 */
/* */
/* --------------------------------------------- */
#include <stdio.h>
#include <iostream>
#include "execute_cmd.h"
void execute_cmd(const char* _cmd, QList<QString>& _output, bool _log)
{
char buffer[65536];
if (_log)
std::cout << _cmd << std::endl;
FILE* pipe = popen(_cmd, "r");
if (pipe)
{
while (fgets(buffer, 65536, pipe) != NULL)
{
_output.push_back(QString(buffer));
}
pclose(pipe);
}
}