Skip to content

Instantly share code, notes, and snippets.

@rodrigoalvesvieira
Last active Oct 15, 2021
Embed
What would you like to do?
#include <iostream>
#include <string>
using namespace std;
// Google Search C++ program
// g++ -o google google.cpp
// ./google rodrigo alves github | xargs open
// sudo mv google /usr/bin
int main (int argc, char *argv[])
{
int i = 1;
string url = "https://www.google.com/search?q=";
for (; i < argc; i++) {
url = url + string(argv[i]);
if (i != argc-1) url = url + string("+");
}
cout << url << endl;
string op = string("open ").append(url);
system(op.c_str());
return 0;
}
@ferVargasB

This comment has been minimized.

Copy link

@ferVargasB ferVargasB commented Aug 29, 2016

Thanks!
I didn't how to open a Url link with cpp.

@yaraxxx

This comment has been minimized.

Copy link

@yaraxxx yaraxxx commented Feb 28, 2019

can you explain line 21 and 22, please ?
I mean like what is the point of writing append?

@ChristianTucker

This comment has been minimized.

Copy link

@ChristianTucker ChristianTucker commented Mar 17, 2019

can you explain line 21 and 22, please ?
I mean like what is the point of writing append?

http://www.cplusplus.com/reference/string/string/append/

@shyed2001

This comment has been minimized.

Copy link

@shyed2001 shyed2001 commented Sep 18, 2021

is this platform independent ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment