How do I open a URL from C++?

Your question may mean two different things: 1.) Open a web page with a browser. #include <windows.h> #include <shellapi.h> … ShellExecute(0, 0, L”http://www.google.com”, 0, 0 , SW_SHOW ); This should work, it opens the file with the associated program. Should open the browser, which is usually the default web browser. 2.) Get the code of … Read more

Difference between shell and environment variables

Citing this source, Standard UNIX variables are split into two categories, environment variables and shell variables. In broad terms, shell variables apply only to the current instance of the shell and are used to set short-term working conditions; environment variables have a farther reaching significance, and those set at login are valid for the duration … Read more

Questions about putenv() and setenv()

[The] putenv(char *string); […] call seems fatally flawed. Yes, it is fatally flawed. It was preserved in POSIX (1988) because that was the prior art. The setenv() mechanism arrived later. Correction: The POSIX 1990 standard says in §B.4.6.1 “Additional functions putenv() and clearenv() were considered but rejected”. The Single Unix Specification (SUS) version 2 from … Read more

Awk/Unix group by

$ awk -F, ‘NR>1{arr[$1]++}END{for (a in arr) print a, arr[a]}’ file.txt joe 1 jim 1 mike 3 bob 2 EXPLANATIONS -F, splits on , NR>1 treat lines after line 1 arr[$1]++ increment array arr (split with ,) with first column as key END{} block is executed at the end of processing the file for (a … Read more