✅ Answers
? Favorite Answer
In C++, the internal representation of a string is hidden. As a user you don’t know and shouldn’t care what a string variable actually looks like on the inside. You access it and operate on it all using the standardised member functions such as at(), size(), length(), replace(), and so on.
But sometimes you will need an old C style string representation of the C++ string object. Namely a sequence of characters terminated with a NULL byte. Often older APIs or external libraries will need a C style string. In this case you use C_str() to get a pointer to a const representation of the C++ string object. Note that because it is a const pointer, you can’t modify the underlying string through this pointer.
To produce a C compatible string for C libraries and functions.
C_str In C
Source(s): https://shrinkurl.im/baxqe
you can use c_str() like this…
ifstream myfile;
string filename;
myfile.open(filename.c_str()); // when normally you would just do myfile.open(“file.txt”);
Source(s): Just used it in c project
Other Related Questions
Learning Visual Basic ?
Answers Favorite AnswerTry using "System.Diagnostics.Process. GetProcessesByName( "iwmp" ).Length > " for your check.
Microsoft Office word Fast answer needed its urgent?
Answers Favorite AnswerTry this:http://www.techsupport.com///microsoft-wo...Here is another thread re: the same issue with instructions:http://www.pcreview.co.uk/forums/modification-not-...http://www.techsupport.com///microsoft-wo...http://support.microsoft.com/kb/http://answers.microsoft.com/en-us/office/forum/of...
What is meant by ROM ? Explain in simple but elaborate terms.What about mobile ROM’s?
Answers Favorite AnswerHi Diva below is a link that will give a simple answer.http://wiki.answers.com/Q/What_does_ROM_stand_for_...Hope this helps.Source(s): Experience and wiki answers.ROM is Read only memory. i.e data can write only once.There two types of ROM..ROM.PROMThe difference between ROM and PROM.that is ROM is programmed during manufacturing it means data stored by manufacturing company.PROM is blank memory that a user programmable memory.user can store content on PROM.both ROM and PROM are Read only memory Data can write only once.and its not possible to write so many time.Memories of PROM and ROM are Non-volatile in nature. Its that stored informations can retain even power goes off.