Created
October 16, 2014 22:31
-
-
Save Lomeli12/ef5c2ea3e6c41c5b27ac to your computer and use it in GitHub Desktop.
How
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
#include <cstdlib> | |
#include <cstring> | |
using namespace std; | |
int main(int argc, char* argv[]) { | |
string google = "https://www.google.com/search?q="; | |
string keyWord = "how"; | |
if (argc > 0) { | |
string srch = keyWord + "+"; | |
for (int i = 1; i < argc; i++) { | |
srch = srch + argv[i]; | |
if (i != (argc - 1)) srch = srch + "+"; | |
} | |
string full = "xdg-open " + google + srch; | |
char * cstr = new char [full.length() + 2]; | |
strcpy(cstr, full.c_str()); | |
system(cstr); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment