CString Convert to LPCTSTR Programming Software Development by rxgmoral … i write DLL file,it is static dll i want CString type Convert to LPCTSTR but error Code: <<<….Cpp>>>>>> LPCTSTR dll::Fun() { CString Rxg=_T("rxg"); LPCTSTR lpszStr=Rxg.GetBuffer(); return… CSTring problem Programming Software Development by jebinaelsie CString constructor or assingnment or serialization of CString causes the application crash in a multi-processor environment,(this happens in a heavily loaded condition when more than 500 threads are running) whereas it does not cause any problem in single processor environment. Re: CSTring problem Programming Software Development by u8sand CString is extict because it is from MFC which is extinct, they may have it available but it is not up to date with everything. Any bugs that they had when they were out are still there. There is no way you can fix that unless you reconstruct the whole CString class so i would try making your own string class or use something that is not MFC. Re: CString Help!! Programming Software Development by desperado85 … like [ICODE]sprintf()[/ICODE], so you can do .. [code] CString data; CString data2 = _T("1200"); data.Format(_T("!64… like to copy the number out from data to another CString data2 so that i can prinf the number from data2… Is there a way to just copy the number from CString data to CString data2? Thank you. CString Help!! Programming Software Development by desperado85 I have a CString : CString data; data.Format = ("!64.8 Px.1= 1200"); I would like to copy the number 1200 from data to another CString data2. Anyone can help? Thanks in advance Re: CString Help!! Programming Software Development by mitrmkar [ICODE]CString::Format()[/ICODE] works like [ICODE]sprintf()[/ICODE], so you can do .. [code] CString data; CString data2 = _T("1200"); data.Format(_T("!64.8 Px.1= %s"), (LPCTSTR)data2); [/code] Re: CString Help!! Programming Software Development by mitrmkar How about by-passing the CString here, and [ICODE]printf()[/ICODE]'ing the number directly, so, [code]// Somewhere you probably have .. int the_number; // .. and then output it .. printf("!64.8 Px.1= %d", the_number); [/code] If that's not an option, then you have to parse the [ICODE]data[/ICODE] string to get the number. Re: CString into string Programming Software Development by eranga262154 …10,200,200), &x , 1)) { CString ss; CFile rtfFile; BOOL err = rtfFile.Open…iLength];// Data buffer rtfFile.Read(pBuffer, iLength); CString rtf(pBuffer); m_rtfCtrl.SetWindowText(rtf); m_rtfCtrl.GetWindowText…; ss << std::endl; // CString into string std::string strRTF(ss.GetString()); std… Re: CString into string Programming Software Development by Ancient Dragon No you can use the CString object directly [code] CString str = _TEXT("Hello World"); AfxMessageBox(str,MB_OK); [/code] or [code] CString str = _TEXT("Hello World"); MessageBox(str.GetBuffer(),"Debug Message",MB_OK); [/code] CString to Integer / Double Programming Software Development by koushal.vv Hi All, i have a problem in converting CString to Int/Double, function i am using is _wtoi , _wtof..... … ret value is 0, Please help me in converting the CString to exact int value Re: CString into string Programming Software Development by Ancient Dragon Are you certain you are talking about line 21? It would seem more reasonable that line 16 should give you that error because [b]ss[/b] is a CString object and cout doesn't know out to output it, or CString doesn't have an << operator for cout unless of course you wrote it yourself. Re: CString to Integer / Double Programming Software Development by Ancient Dragon There isn't much you can do about overflows, except just discard the bad CString value. It returns INT_MAX because its impossible to put that many digits into an int variable. I'd like to stuff my 100 inch waste into size 36 slacks too, but that's not possible either :) Re: CString to Integer / Double Programming Software Development by koushal.vv … i have made a check like this [CODE] int ConvertToInt( CString intVal ) { int ret = _wtoi(intVla); if((ret == 0) || (errno == ERANGE… CString Lenght Programming Software Development by atrusmre how do you find the length of a CString? Re: CString Lenght Programming Software Development by WolfPack [URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cstring.3a3a.getlength.asp]CString::GetLength[/URL] CString into string Programming Software Development by eranga262154 Hi all, What is the easiest way to convert a CString into a standard C++ sting. Thanks Re: CString into string Programming Software Development by Ancient Dragon [code] CString mystring = _TEXT("Hello World"); string astring = (LPCTSTR)mystring; // assuming UNICODE is NOT defined or string astring = mystring.GetBuffer(0); [/code] Re: CString into string Programming Software Development by FireNet Or over load the << operator for an ostringstream inheriting class and pipe all the output to into a text box. eg... [code] class mfc_text_box : public ostringstream { //pseudo -code operator << (Cstring &x) { write_txt_to_box(x.c_str()); } } [/code] Then you can use a mfc_text_box_obj just like cout. Re: CString into string Programming Software Development by eranga262154 Yes that is true. First parameter points to either CString object or null-terminated string. So here I have to use a null terminated string. Now its clear to me. cstring statistics Programming Software Development by harneetarora …; #include <fstream> #include <cctype> #include <cstring> #define DELIMS " .\n" using namespace std; int… CString Formatting error Programming Software Development by abhi.nalluri ….I am usind the following code to do this. [code] CString tmp; tmp.Format("%4d %4d %4d",a,b… Re: CString Formatting error Programming Software Development by abhi.nalluri Thanks, But I tried even that.but in vain.When I am printing that to the console I can see the alignment but when I convert (Format) it to CString I am missing the alignment.Could there be any other fix... cstring to int with characters Programming Software Development by GulnazS Could someone help me, please: How can I convert a cstring (Input math expression) into an array of integers and characters(*, +, etc.)? I know atoi function would return 0, if there are other characters, not digits. Is there a function to do it? I appreciate any help. Thank you. <cstring> to find length, upper/lower case of full name Programming Software Development by DS9596 …, then just first name. #include <iostream> #include <cstring> #include <stdio.h> using namespace std; int… Re: usage of cstring Programming Software Development by Ancient Dragon >>CString str=(_T(buffer)); The _T macro only works with string … Re: Relationship Between CString Class, MFC, And iostream.h Programming Software Development by opcode CString class is actually not belong the MFC class … ATL. You can use appropriate ATL headers to use CString in any Windows C++ application. For more information on… how you can use CString in a C++ project, read thease articles. [URL=&… use [URL="http://www.frostcode.info/strings/cstring-class.html"… Re: Conversion from char[] to CString Programming Software Development by Ancient Dragon CString has a Format() method that works exactly like sprintf(). Simplify your code like this: [icode] CString m_strFileName.Format("%02d/%02d/%4d %02d:%02d:%02d", t.wDay,t.wMon,t.wYear, t.wHour,t.wMinute,t.wSecond); [/icode] Adding 5 to t.wHour can easily make t.wHour exceed 60. Re: Manipulating CString Programming Software Development by Ancient Dragon CString has Left(), Right(), and Mid() methods which are something like std::string's substr() method. Re: Conversion from char[] to CString Programming Software Development by Moschops CString m_strFileName(time); Re: HELP | Convert CString to char | Unicode Programming Software Development by kndubey88 CString str = "hello"; char* strBuf = new char[20]; int i = 0; for(int i = 0 ; i < str.GetLength(); i++) { strbuf[i] = str[i]; } strBuf[i] = NULL; /*this code is for unicode mfc vc++ and it works.