how to initialize a class with the type of a file I'm a begginer and I don't know how to deal with this task :     *This class is intended to be instantiated with a src character string as a parameter of its constructor. It must then:    *-&gt; Determine the type of file to which src corresponds (among: image, video, security plan [.mps]), using the extension    *-&gt; Check if the file corresponding to src exists.    *-&gt; If the file does not exist, the src member variable of File is initialized with a path to a file by default, depending on the type    *(if the desired file was an image, src will contain the path to an &quot;Error&quot; image, ditto for videos and mps).   In File.h :         class File{         private:             string src;             string type;                  public:             string description;                      File();             File(string src);            ~File();             bool exists();     };  In File.cpp: File::File(string src):src(src){}  bool File::exists(){}  The thing is that I don't know how to check the file's exention from a string :/ .
How to get file extension from string in C++ Given a string "filename.conf", how to I verify the extension part?  I need a cross platform solution.
What is the metal sheath surrounding a USB connector, and is it commonly connected? Understanding QGIS buffer tool units No upgrade available for 19.04 from 18.10 I'm pretty new to running linux, but I know that 19.04 was released today and I wanted to upgrade from my current 18.10. However, when I follow the release notes here:  I get the message "The software on this computer is up to date". I made sure that my update settings are set to "any new version" and "normal" in the /etc/update-manager/release-upgrades file.   What am I doing wrong?  Thanks for the help!  Side note: I had to disable this PPA:  because it would cause errors in apt updating. Do I need to re-add it? If so how do I do so without it giving me an error?  Edit: I have followed the procedure recommended in the documentation which is identical to the suggested duplicate, but I am not given the option to upgrade. I have not yet tried the   do-release-upgrade -d    option as I don't want to upgrade to the developer version. Each  has a compiled cost that contributes towards the  compiled character formula limit.  What are the current compiled costs associated with each formula function? I need to factory reset my Macbook but cannot recall the password. So I used Cmd+R during startup and go to terminal and typed 'resetpassword' according to this advice    Now 'Reset Password' application appears but there is nothing where I have to select the volume containing the user account. Why does this happen? Constructing a continuous function whose graph seems 'special' I've been reading through Zorich's "Analysis I" book recently, and I came across this nice little exercise.  Let $f: [0,1]\to \mathbb R$ be a continuous function such that $f(0)=f(1)$. Show that    for any $n\in \mathbb N$ there exists a horizontal closed interval of length $\frac 1n$ with endpoints on the graph of this function; if the number $\ell$ is not of the form $\frac 1n$ there exists a function of this form on whose graph one cannot inscribe a horizontal chord of length $\ell$.   The first part can be proven like this: Consider $g: [0,(n-1)/n] \to \mathbb R$ given by $g(x) = f(x) - f(x+1/n)$. Then   $$\sum_{k=0}^{n-1} g(k/n) = 0$$  and therefore either all of these points are zero or there exists both a point where $g$ is positive and a point where $g$ is negative. By continuity, there must then also be a point where $g = 0$. So we are done.  Now, the second statement seemed rather counterintuitive, and I have given it some time now, but don't see a counterexample for $\ell &lt; 1/2$.  (For $\ell &gt; 1/2$ the function $f(x) = \sin(2\pi x)$ will do.)  Can anyone help me out?  Cheers, How to "flatten" a multi-dimensional array to simple one in PHP? It's probably beginner question but I'm going through documentation for longer time already and I can't find any solution. I thought I could use implode for each dimension and then put those strings back together with str_split to make new simple array. However I never know if the join pattern isn't also in values and so after doing str_split my original values could break.  Is there something like combine($array1, $array2) for arrays inside of multi-dimensional array? My ubuntu partition was deleted and I can't boot from either a DVD or USB $\lfloor x\rfloor + \lfloor y\rfloor \leq \lfloor x+y\rfloor$ for every pair of numbers of $x$ and $y$ What licence is subscriber content provided under 4.0, 3.0 or them all? Inequality involving $\limsup$ and $\liminf$: $ \liminf(a_{n+1}/a_n) \le \liminf((a_n)^{(1/n)}) \le \limsup((a_n)^{(1/n)}) \le \limsup(a_{n+1}/a_n)$ This may have been asked before, however I was unable to find any duplicate. This comes from  of "Mathematical Analysis: An Introduction" by Browder. Problem 14:     If $(a_n)$ is a sequence in $\mathbb R$ and $a_n &gt; 0$ for every $n$. Then show:   $$ \liminf(a_{n+1}/a_n) \le \liminf((a_n)^{(1/n)}) \le \limsup((a_n)^{(1/n)}) \le \limsup(a_{n+1}/a_n)$$   The middle inequality is clear. However I am having a hard time showing the ones on the left and right. (It seems like the approach should be similar for each). This is homework, so it'd be great if someone could give me a hint to get started on at least one of the inequalities.  Thanks. Guid vs INT - Which is better as a primary key? Getting JavaScript object key list List contents of tarball in tree format Per the answers  I'm able to list the contents of my tarball in ls format. However, I'd like to be able to list them in tree format, i.e. something like the latter instead of the former:  With tar:  $ tar -tf foo.tar  foo/ foo/baz/ foo/baz/qux/ foo/baz/qux/hisfile.txt foo/bar/ foo/bar/myfile.txt foo/bar/yourfile.txt   With tree:  $ tree foo foo ├── bar │   ├── myfile.txt │   └── yourfile.txt └── baz     └── qux         └── hisfile.txt   Is it possible to do this without extracting the tarball? I'd prefer to have to avoid extracting the tarball due to their size. How to remove or hide the GRUB boot menu? I want to create a custom control in C#. But every time I have to fully redraw my control, it flickers, even if I use double buffering (drawing to an Image first, and blitting that).  How do I eliminate flicker when I have to fully redraw? Is there a way to get reverse numbering on the enumerate environment? To build a list of publications, I wish to show the most recent on top of the list, while keeping the numbering similar. This can be achieved manually by doing something like:  \begin{enumerate} \item[42] pub num 42 \item[41] pub num 41 \item[...] \item[1] pub num 1 \end{enumerate}   but is there a more principled approach? How does an internet server respond to a request from a private IP? SQL - Stored Procedure with Select Statement using IN (@Variable_CommaDelimitedListOfIDS) When should you use a class vs a struct in C++?