SEARCH YOUR SOLUTION HERE  

String literal encoding - What can it be?

Dear group,

I need to know what the string literal encoding and maybe the wide string
literal encoding can be according to the standard. Is is totally
implementation specific If so are there any means (portable or not) to
detect the encoding which is used

Cheers,
Philipp


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Posted On: Monday 5th of November 2012 01:25:59 AM Total Views:  323
View Complete with Replies




Related Messages:

ostringstream and sgetn() weirdness   (141 Views)
hi, i have come aross a strange problem with a bit of code that uses a ostringstream to build up a string and i extract the string into a user buf via the sgetn() call instead of via the str() method. however, it appears that when the contents extracted via sgetn() are invalid for the first extract. below is a test prog that demonstrates the issue. we are using Forte 7.0 on solaris 5.8; i dont have access to gcc (or any other c++ compiler). can someone tell me where i'm going wrong thanks ray #include #include #include #include #include using namespace std; int main(int argc, char* argv[]) { try { ostringstream dump; size_t sz = 0; if (argc == 1) { dump sgetn(tmp, 4); tmp[4] = NULL; dump.seekp(0); // this comes out as empty string!!! cout
Reliably cross-platform determining read-only string   (112 Views)
I was wondering, is it possible to determine whether a string can be modified (const char *) by the application or whether it's located in what's commonly .rodata
string formatting in cpp   (157 Views)
Hi - I have the need to format my input string by putting single quotes around them. Right now I am converting the string object to a c style string so that I can use sprintf. see code snippet below: 1 string insert_str; 2 const char* t = table.c_str(); 3 const char* i = input.c_str(); 4 insert_str = printf("insert into %s VALUES( '%s'", t, i); 5 cout
string class problem   (111 Views)
can anyone tell me a solution: i cannot use the features in standard c++ string classgh i included the string.h file but still its not working.
error: 'string' does not name a type   (136 Views)
What would cause this error Here is the code: #include class name { public: // default constructor void NAME() { FirstName = "John"; MiddleName = "H."; LastName = "Doe"; } // non-default constructor string NAME(string FN, string MN, string LN) { FirstName=FN; MiddleName=MN; LastName=LN; } // returns First Name, Middle Name, and Last Name in order void getFirstLast() { } // prints the first, middle, and last name void print() { } private: string FN, MN, LN; }
string and class error   (99 Views)
i have created a class which contains all the information needed for a program based on accounts, this is shown below. When compiled the string "word" (in function writetofile) which is initialised in the constructor is apparently "undeclared", yet it has been declared in the constructor. i am new to c++ class programming, do i need to also declare it, as well as initialise and if not, what is the problem and how can it be solved thanks wilson #include #include #include #include #include using namespace std; class Account { friend void new_account(); public: Account(){string word = "hello";}//can eventually be user inputted void returnbalance() { std::cout
string literals in overlapping areas of memory   (108 Views)
Quote: draft explicitly allows compilers to store string literals in overlapping areas of memory as a space optimization. Ref: http://www.gotw.ca/gotw/011.htm Can some one please help me to understand how compiler would store string literals in overlapping area of memory Has it something to do with substrings Is it same as 14882-2003 1.13.4.2 (or draft refers to C++ 0x ) -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] , > Can some one please help me to understand how compiler would store > string literals in overlapping area of memory If you had #include int main { std::cout
reading string from text file in vc++ atl project without mfc support   (137 Views)
Hi I am having a typical problem from last one day.I am being able to writ into a text file from my vc++ application,but I am not being able to read the file.actually I need to write something in the file and I need need to again read the file.here is y code which is working fine for writing to file: FILE *fp=NULL; fp=_wfopen(lstr,_T("w+"));//lstr is having the path to the file fwrite( strTitleCurrentDate, sizeof(TCHAR), strTitle.GetLength()/ ** sizeof( TCHAR )*/, fp ); fclose( fp ); this code is working fine but CString strTitle1; newBuffer=strTitle1.GetBuffer(strTitle1.GetLength()* sizeof( TCHAR )); LPTSTR lstr=strPath2.GetBuffer(strTitle.GetLength()* sizeof( TCHAR )); FILE *fp=NULL; fp=_wfopen(lstr,_T("a+")); while(!feof(fp)) fread( newBuffer, sizeof(char), 100/** sizeof( TCHAR )*/, fp ); fclose( fp ); This piece of code really meking me frustrated because the data in file I am being able to read which actually should be "15th june 2007" is coming as "15th june 2007SID",from where this SID is comingOne more thing is that after this code of file reading if I take any CString variable and try to display it in a message box,it is showing the value "15th june 2007SID" whereas it should show blank.I am getting crash also in my application may be due to this problem.Plz help me to solve this problem with code,because it will help me a lot.Plz help me as early as possible because the deadline is coming and I am being frustrated.I also have to read data in a text file line by line which is also not being possible for me.Plz help me with code.
Interesting string.resize behavior   (120 Views)
#include #include using namespace std; int main() { string str; str.resize(5); str[0] = 't'; str[1] = 'e'; str[2] = 's'; str[3] = 't'; str[4] = '\0'; str += "-test2"; str += "-test3"; cout
best efficient and readable way to concatenate strings (or the best trade-offs)   (154 Views)
Since C++ (and STL) have many ways to do string concatenation, I want to hear (read) from you how you do to concatenate strings with other strings and other types. The approaches I know are: -- ostringstream this does the job well, but: * all types involved have to support operator
Need help converting a string to a float...   (174 Views)
I'm having this weird problem where my code does the following conversion from string to float: 27000000.0 -> 27000000.00 2973999.99 -> 29740000.00 2989999.13 -> 2989999.25 The number on the left is the string I get after tokenizing a bigger string. The number on the right is the number I get after the conversion. I've tried two different ways of converting, one way the older C way using atof, and another more C++ way. Either way, I get the same result. Can anyone shed some light on this for me Here's the code: string token; string tokens[14]; stringstream iss; getline(fin,bfr); while (getline(fin, bfr)) { iss > price; //price = atof(tokens[0].c_str());
strtok as string replace function problem ?   (162 Views)
I have selected strtok to be used in my string replacement function. But I lost the last token, if there is one. This string would be replaced select "name", "vorname", "userid", "passwort" from "users" order by "users" by this one: select "name", "vorname", "userid", "passwort" from "users" order by "users Thus the last quot is lost. Is there something missing in the code
MFC 8.0 - static link misses Afx strings   (89 Views)
when I link my MFC 8 application statically, the strings like "The file %s has been chanegd, do you want to save the changes" are missing (empty). Is there any way to fix this (include these resources at compile time) -- -Gernot int main(int argc, char** argv) {printf ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
How to declare and define a string array?   (133 Views)
This is for characters : CHAR char i = `a`; STRING char i[] = "aaaaa"; How to do it for string arrays
How to convert string to operator   (107 Views)
I have a function which takes two operands (char*) and a operator (char*) int myFunc(char* operand1, char* operand2, char* myoperator); Depending upon the operator, i want to do the manipulation on both operands. I dont want to hardcode the operator values or use of switch/ if-else statement to determine the operation. Is there any way to solve this problem
FILE *fd to string   (83 Views)
I have a C style function which is of the form writestuff(FILE *fd). Now this function writes strings to the FILE* provided. Is there a way to collect this output into a string (without the obvious creating and reading of a temp file). I just want the output of the 'writestuff' function to be collected into a std::string. I can't modify the writestuff function to do the needful. Any suggestions
Should be simple string problem   (115 Views)
I have this simple string problem. Here's the function using namespace std; void Debug(string msg) { if (GblDebug == false) return; printf(" debug : %s",msg.c_str()); } Here's a call to it. Debug("arb " + layer + "\n"); Here's the compiler error error: invalid operands of types `const char*' and `const char[2]' to binary `operator+'
Quicksort for list of string   (88 Views)
can any one tell me if I give the followiing string in input: ABC abc BBC then how I can get ABC abc BBC or abc ABC BBC as my output usiing quicksort. and it must be list using STL
undefined behaviour in std::string find() ?   (134 Views)
, This is a rephrase of a question I asked in c.l.c++ In a program of mine, i had code like: pos2 = my_string.find( '/', pos1 ); when pos1 reached string::npos, I get different results depending on wether '/' is present in my_string or not. (this is with gcc 4.1.2) I looked up Jossutis, but that book only states: "These functions return the index of the character when successful or string::npos if they fail" I would expect it to fail with npos as index, but gcc just rewraps ans starts searching at the begin of the string. This is strange and annoying, but is "acceptable" when this is indeed Undefined Behaviour. So is it Ko vd Sloot Tilburg University Demo program: #include #include using namespace std; int main(){ string use = "anu"; string::size_type pos1 = use.find_first_not_of( "an" ); cerr
const char* vs string   (106 Views)
, in which cases is it better the use of "const char*" to "string" (or even const string &). I mean, in STL (http://www.sgi.com/tech/stl/hash_map.html) I see: hash_map months; months["january"] = 31; I think it is for the use in calls like function("my string"), but, is it really necessary to define funcion(const char*) besides function(const string &) in my public member functions I have read that the compiler does too much temporaries variables in such cases, but is it true And what about in: string mystring = "my string" + string1 + " is " + string2; or in: cout