https://dune.bnl.gov/w/index.php?title=C%2B%2B&feed=atom&action=historyC++ - Revision history2024-03-28T08:07:34ZRevision history for this page on the wikiMediaWiki 1.34.4https://dune.bnl.gov/w/index.php?title=C%2B%2B&diff=2351&oldid=prevMaximPotekhin: Created page with "=String Comparison= <pre> // comparing apples with apples #include <iostream> #include <string> int main () { std::string str1 ("green apple"); std::string str2 ("red app..."2018-12-06T20:06:16Z<p>Created page with "=String Comparison= <pre> // comparing apples with apples #include <iostream> #include <string> int main () { std::string str1 ("green apple"); std::string str2 ("red app..."</p>
<p><b>New page</b></p><div>=String Comparison=<br />
<pre><br />
// comparing apples with apples<br />
#include <iostream><br />
#include <string><br />
<br />
int main ()<br />
{<br />
std::string str1 ("green apple");<br />
std::string str2 ("red apple");<br />
<br />
if (str1.compare(str2) != 0)<br />
std::cout << str1 << " is not " << str2 << '\n';<br />
<br />
if (str1.compare(6,5,"apple") == 0)<br />
std::cout << "still, " << str1 << " is an apple\n";<br />
<br />
if (str2.compare(str2.size()-5,5,"apple") == 0)<br />
std::cout << "and " << str2 << " is also an apple\n";<br />
<br />
if (str1.compare(6,5,str2,4,5) == 0)<br />
std::cout << "therefore, both are apples\n";<br />
<br />
return 0;<br />
}<br />
</pre><br />
<br />
=BOOST=<br />
https://askubuntu.com/questions/263461/where-is-my-boost-lib-file<br />
<br />
install libboost-all-dev<br />
<br />
=ROOT=<br />
==Installation==<br />
ROOT can be built with XRootD included. When building from source, the user might need to install<br />
certain packages depending on what's reported missing in the error log. For example,<br />
<br />
<pre><br />
sudo apt-get install libx11-dev<br />
sudo apt-get install libpthread-stubs0-dev<br />
sudo apt-get install libxpm-dev<br />
sudo apt-get install libxft-dev<br />
sudo apt-get install libxext-dev<br />
sudo apt-get install libxml2-dev<br />
</pre><br />
<br />
==File modes==<br />
<br />
* NEW or CREATE Create a new file and open it for writing, if the file already exists the file is not opened.<br />
* RECREATE Create a new file, if the file already exists it will be overwritten.<br />
* UPDATE Open an existing file for writing. If no file exists, it is created.<br />
* READ Open an existing file for reading (default).<br />
<br />
==Terminating a program==<br />
In a ROOT macro, to exit gracefully:<br />
<pre>gApplication->Terminate().</pre><br />
<br />
In a standalone program this becomes simply "return 0;"<br />
<br />
==Fixing GL problems at CERN==<br />
There may be complicated problems when using ROOT which can be traced<br />
to certain drivers and/or configuration error. At CERN (lxplus) the following<br />
fix usually works and allows to run ROOT remotely via X11:<br />
<pre><br />
source /afs/cern.ch/sw/lcg/external/gcc/4.9/x86_64-slc6-gcc49-opt/setup.sh<br />
source /afs/cern.ch/sw/lcg/app/releases/ROOT/6.06.08/x86_64-slc6-gcc49-opt/root/bin/thisroot.sh<br />
</pre></div>MaximPotekhin