This commit is contained in:
Hauke Zühl
2016-05-02 11:58:52 +02:00
parent f0351e40de
commit cdf5271db0
5 changed files with 0 additions and 71 deletions
-21
View File
@@ -1,21 +0,0 @@
#include "Telegram/exec.h"
#include <iostream>
#include <stdio.h>
std::string exec(const char* cmd) {
FILE* pipe = popen(cmd, "r");
if (!pipe)
return "ERROR";
char buffer[128];
std::string result = "";
while (!feof(pipe)) {
if (fgets(buffer, 128, pipe) != NULL)
result += buffer;
}
pclose(pipe);
return result;
}
-28
View File
@@ -1,28 +0,0 @@
#include "Telegram/explode.h"
std::vector<std::string> explode( const std::string &delimiter, const std::string &str) {
std::vector<std::string> arr;
int strleng = str.length();
int delleng = delimiter.length();
if (delleng == 0)
return arr;//no change
int i = 0;
int k = 0;
while(i < strleng) {
int j = 0;
while ((i+j < strleng) && (j < delleng) && (str[i+j] == delimiter[j]))
j++;
if (j == delleng) {
arr.push_back(str.substr(k, i-k));
i += delleng;
k = i;
} else {
i++;
}
}
arr.push_back(str.substr(k, i-k));
return arr;
}