I copied this problem straight out of the textbook , and it won't compile. Compiler is gcc 5.4.0. this is the my program:  #include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt; using namespace std;  int main()  {     string fileName;     char ch;     fstream file;      cout &lt;&lt; "enter a filename: ";     cin &gt;&gt; fileName;      file.open(fileName, ios::in);      if(file)     {         file.get(ch);          while(file)         {             cout &lt;&lt; ch;              file.get(ch);         }         file.close();     }      else          cout &lt;&lt; fileName &lt;&lt; " could not be opened.\n";     return 0; }   Again, I copied this straight out of the text. In fact it fails immediately after this point:  #include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt; using namespace std;  int main()  {     string fileName;     char ch;     fstream file;      cout &lt;&lt; "enter a filename: ";     cin &gt;&gt; fileName;      file.open(filename, ios::in);      // comment everything else out and compile still fails      return 0; }   this is the errors spit in the console:  chp12chal.cpp: In function ‘int main()’: chp12chal.cpp:15:32: error: no matching function for call to ‘std::basic_fstream&lt;char&gt;::open(std:: __cxx11::string&amp;, const openmode&amp;)’      file.open(filename, ios::in);                            ^ In file included from chp12chal.cpp:2:0: /usr/include/c++/5/fstream:1001:7: note: candidate: void std::basic_fstream&lt;_CharT, _Traits&gt;::open (const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits&lt;char&gt;; std: :ios_base::openmode = std::_Ios_Openmode]               open(const char* __s,        ^ /usr/include/c++/5/fstream:1001:7: note: no known conversion for argument 1 from ‘std::__cxx11:: string {aka std::__cxx11::basic_string&lt;char&gt;}’ to ‘const char*’   So I'm not sure what all of that means. Though I only started having this problem once I started taking user input as a variable for the input stream.   When I simply code in the path of the file to open it works fine.   Also, I know fileName and filename are not spelled the same, but that's the way it is done throughout the book in numerous examples so I'm leaving that as so.   Could this be a compiler specific issue?  addendum:  I did also try:  string fileName; fileName = "chp12txt.txt"; char ch; fstream file;  file.open(fileName, ios::in);   To rule that out and still get same errors.
This should be a fairly trivial problem. I'm trying to open an ofstream using a std::string (or std::wstring) and having problems getting this to work without a messy conversion.  std::string path = ".../file.txt";  ofstream output;  output.open(path);   Ideally I don't want to have to convert this by hand or involve c-style char pointers if there's a nicer way of doing this?
Resuming a list We don't get much snow in the UK, so I don't have much experience photographing it, and when I tried photographing falling snow last year I found it very hard to capture the snowflakes in the air — they either didn't show up or were just streaks. Is there a shutter speed that is best for this? I don't want to use flash to do so.  Any other snow photography tips welcome from those in snowier places! Physics are not simulated past a certain frame? Who are the 3 men who would have a chance against Jaime Lannister in a sword fight? In Game of Thrones season 2, episode 8, "The Prince of Winterfell" , Jaime Lannister says to Brienne:     There are three men in the kingdoms who might have a chance against me [in a sword fight]   Who are those three people?                                  I don't believe this quote, or any variation, appears in the books. There was this quote from A Storm of Swords when he is fighting Brienne:     She is stronger than I am.      The realization chilled him. Robert had been stronger than him, to be sure. The White Bull Gerold Hightower as well, in his heyday, and Ser Arthur Dayne. Amongst the living, Greatjon Umber was stronger, Strongboar of Crakehall most likely, both Cleganes for a certainty. The Mountain’s strength was like nothing human. It did not matter. With speed and skill, Jaime could beat them all.   So in the books it suggest that Jaime can beat anyone, though he is only referring to people of great strength, not necessarily of great skill (somebody such as Barristan Selmy, who is not considered to be exceptionally strong but is exceptionally skillful, may be able to beat him).  Is there any canon evidence to suggest who these three people may be?  I won't accept any purely speculative answers. However if there is no direct canon quote answering the question (which I believe to be the case) I will consider answers that are strongly inferred from canonical sources (such as a canon quote saying X is the greatest fighter in the kingdom, for example). While studying the problem of determining the orbit of a binary star system, my astronomy notes say: "the projection of an ellipse onto a plane is still an ellipse (except the special case in which it's a segment)". How could I prove this?  EDIT: As suggested i'm adding what I know about ellipses. I know the basics of ellipses in the plane, the equation of an ellipse in a plane in cartesia coordinates, the equation of an ellipse in polar coordinates, the fact that ellipses can be obtained by the intersection of planes with a cone. In my geometry course we defined ellipses as the the points of the plane such that the ratio between the distance from a point and a line is constant and less than 1. I also know that the sum of the distances of the points of the ellipse from the foci is constant. Floating point calculations in LaTeX? Is there a formula for $(1+i)^n+(1-i)^n$? 'had better not entangle' v 'had better not to entangle' Can I write this sentence:     He said Carter had better not entangle the US in problems like those   in Afghanistan, Somalia and Iraq.   Like this:     He said Carter had better to not entangle the US in problems like those   in Afghanistan, Somalia and Iraq.   ?  If so, what's the difference between the meaning of both sentence? Minecraft crashes on launch with EXCEPTION_ACCESS_VIOLATION, Problematic frame: ig4dev32.dll or ig4dev64.dll or ig4icd32.dll or ig4icd64.dll Unity shows wrong distribution name I have been playing around with camera tracking and I'm happy enough with the tracking and alignment of the markers with the footage when viewed through the camera.    The problem is, when I am not looking through the camera I can see that the grid isn't aligned to the camera.    How do you correctly align the grid to this tracked camera? I have set a floor and two points for scale, also clicked setup tracking scene, but this just added cube and plane which were on the grid. How do I do Combinatorics / Counting? If someone could give answers and explain, it would be greatly appreciated. Help required studying for a final.  One hundred tickets, numbered 1,2,3,…,100, are sold to 100 different people for a drawing. Four different prizes are awarded, including a grand prize (a trip to Tahiti).   A) How many ways are there to award the prizes?  B) How many ways are there to award the prizes if the person holding ticket 47 wins the grand prize?  C) How many ways are there to award the prizes if the person holding ticket 47 wins one of the prizes?  D) How many ways are there to award the prizes if the person holding ticket 47 does not win a prize?  E) How many ways are there to award the prizes if the people holding tickets 19 and 47 both win prizes?  F) How many ways are there to award the prizes if the people holding tickets 19, 47, 73, and 97 all win prizes?  G) How many ways are there to award the prizes if none of the people holding tickets 19, 47, 73, and 97 wins a prize?  H) How many ways are there to award the prizes if the grand prize winner is a person holding ticket 18, 47, 73, or 97?  I) How many ways are there to award the prizes if the people holding tickets 19 and 47 win prizes, but the people holding tickets 73 and 97 do not win prizes? How to get the Duke O' Death? I was watching some videos on YouTube showing how to get the Duke O' Death in GTA 5, however what I have seen is sort of unclear.  Some people say you must be a returning player on GTA 5 to get it (what does this mean too BTW?), some people don't say that. Some people say you have to be Trevor, some people don't. Some say the time of day matters, some don't. And apparently you can buy it from Warstock website (I can't).   Can someone please tell me how to get it?! GTA 5 came with my PS4 (I didn't play it on PS3) if that helps. I don't know if this is a well-known fact, but I have observed that every number, no matter how large, that is equally divided by $9$, will equal $9$ if you add all the numbers it is made from until there is $1$ digit. A quick example of what I mean:  $9*99 = 891$ $8+9+1 = 18$ $1+8 = 9$  This works even with really long numbers like $4376331$ Why is that? This doesn't work with any other number. Similarly for $11$ and alternating digits sums. How did Thanos know about the power of "The Snap"? In the scene on Titan with Doctor Strange in Avengers: Infinity War, Thanos said,     With all six Infinity Stones, I will simply snap my fingers and it would all cease to exist.   Then again, in the very first scene with Thor and Loki, when Maw gave Thanos the Space Stone, he said that no one has ever worn two Infinity Stones together.   So how come Thanos knew about the power of the Snap? Because as Wong puts it to Tony, the Big Bang hurled the six Infinity Stones across the universe.   So if no one had collected all the six stones before Thanos, then how did he know about the ability to "Snap"? I have quite a bad habit of copy-and-pasting my packages from one LaTeX document to another. Is there any way we can detect unused packages (i.e. \usepackage commands) so that they can be removed from the LaTeX document? So why did the price tank all of a sudden and then came back to normal? What does it mean? Why Didn't People Think That Voldemort Died After His Attack on Baby Harry? After the Avada Kedavra curse rebounded from Harry onto Voldemort, Voldemort disappeared. I'm curious as to why so many key players believed Voldemort was still "alive" somewhere, his powers decimated, but, under the right circumstances, able to return to full power. It seems the witches and wizards in chapter one of Philosopher's Stone, The Boy Who Lived, were happy to believe that Voldemort was gone forever. Why didn't everyone believe Voldemort had died, rather than just disappeared? Was it the lack of a body? Or were there other reasons?  Here's a couple of quotes from Philosopher's Stone if anyone wants to review them. Otherwise, just disregard.     ‘A fine thing it would be if, on the very day You- Know-Who seems to have disappeared at last, the Muggles found out about us all. I suppose he really has gone, Dumbledore?’   ‘It certainly seems so,’ said Dumbledore. ‘We have much to be thankful for.’   Philosopher's Stone - page 13 - Bloomsbury - chapter 1, The Boy Who Lived   ‘But what happened to Vol– sorry – I mean, You-Know-Who?’   ‘Good question, Harry. Disappeared. Vanished. Same night he tried ter kill you. Makes yeh even more famous. That’s the biggest myst’ry, see ... he was gettin’ more an’ more powerful – why’d he go?   ‘Some say he died. Codswallop, in my opinion. Dunno if he had enough human left in him to die. Some say he’s still out there, bidin’ his time, like, but I don’ believe it. People who was on his side came back ter ours. Some of ’em came outta kinda trances. Don’ reckon they could’ve done if he was comin’ back.   ‘Most of us reckon he’s still out there somewhere but lost his powers. Too weak to carry on. ’Cause somethin’ about you finished him, Harry. There was somethin’ goin’ on that night he   hadn’t counted on – I dunno what it was, no one does – but somethin’ about you stumped him, all right.’   Philosopher's Stone - pages 46-47 - Bloomsbury - chapter 4, The Keeper of the Keys Determine if an element has a CSS class with jQuery I'm working with jQuery and looking to see if there is an easy way to determine if the element has a specific CSS class associated with it.  I have the id of the element, and the CSS class that I'm looking for.  I just need to be able to, in an if statement, do a comparison based on the existence of that class on the element. We will generate a csv file with below values  yp1234,577,1,3 yp5678,577,3,5 yp9012,132,8,9   I need to extract data and create files based on second column. If it's 577 then the whole line has to be extracted and placed in a separate file. I mean I need a file having lines with second column as 577 alone and another file with second column as 132 alone  I tried using IF but didn't work