I want my program read the file and when encounter any enum type, instead of treating it as a string, I want the program store it in memory as a enum value.
How can I do that?
string s; ifs>>s; s // how to convert it to enum???
Ok, so I'm writing this code and when I build it keeps saying cannot implicitely convert type int to string even though I declared my variables as string. Why is it giving me this error?
private static string Repair() { string result=""; string beep; string spin; Console.WriteLine("Does your computer beep on startup?:(y,n)");
these function do the same of the sprintf() function. but instead we use a variable for add the result, i want to return the result. when i use it:
string f; f=ToString("hello world"); gives me several errors: "error: crosses initialization of 'std::string f'" "error: jump to case label [-fpermissive]"
I am using Visual Studio 2008. I just wonder if there are any library function in Windows SDK or MFC, or from third-parties, that can convert a UTF-8 string into Windows Unicode string(used in CString object).
Can MultiByteToWideChar or ATL String conversion macro like A2W to the conversion?
This sends the buffer to a LIN modem. My question is: can this be done better. If I have a astring of hex numbers like "09 98 88 55 42 FF 00 00 FF BD 89". How could I send this without manually makng a char with hex numbers?
My teacher has done a very poor job of teaching us anything this year. When he taught us for loops, he wrote one on the board, didn't explain any of it, then said now that you know for loops we can implement them in a code. but anyway, we need to write a code for converting a string to an int and all the examples i find on the internet use pointers but we aren't allowed to use those yet.
Square.cpp:30:8: error: prototype for ‘std::string Square::int2string(int*)’ does not match any in class ‘Square’ Square.h:21:10: error: candidate is: std::string Square::int2string()
I declared the following in header file.
string int2string();
The error is due to variable type does not match. Is there a better way to convert int array to string?
What I'm trying to achieve is a string printed in the following manner:
I have to convert my netpay which is a float to a string So if i have 356.26 it should output the sum of three hundred fifty-six and 26/100 dollars my program function works for the sum of three hundred but after that it spits out garbage.
I've been trying to write some code to do what I mentioned in the title, but I haven't had much luck. I get very confused when I deal with bitwise operators, so it's hard for me to write this kind of encoding on my own. I need this encodement so I can login to an email account using smtp.
I'm having a problem converting part of a string to an integer.I used strtok to seperate my string and I have also a function for atoi but how to apply it to my strtok function.What i need is to change the char *years to an int.Have a look of what I got:
Code: int main() { char sentence[]="trade_#_2009_#_invest_#_DEALING"; char *word=strtok(sentence, "_#_"); char *year=strtok(NULL, "_#_");; // assigning NULL for previousely where it left off char *definition=strtok(NULL,"_#_"); char *synonyms=strtok(NULL,"_#_");
I wish to convert a character directly to a string for a top-secret project I'm working on. It needs to be portable across various machines with different sized Indians.
Code:
#include <stdio.h> int main(void) { const int i = 0x0041; const char *str_p = (char *) &i; }
[code]....
I want this to output an 'A', but I'm not sure this code will work on my friend's mom's S/360.