0
votes
2answers
23 views

cannot convert parameter 1 from 'const char [6]' to 'const wchar_t *

I'm new to MFC and I don't know what to do with this error. ERROR error C2664: 'void ATL::CStringT::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [6]' to 'const ...
0
votes
1answer
22 views

How to add handler to the format function of CString

First I have a CString(MFC) CString csSQL When format a sql string, for example csSQL.Format( szFormat, szTableName, szColumn, szValue, intValue ) I need to handle the special char in szValue, ...
-2
votes
1answer
46 views

How to split word from CString?

I have a first case: CString stVal = " dsc | resource.c |* "; in Second case: CString stVal = " resource.c |MS"; I want only file name in both case. Please note that I am using visual studio ...
1
vote
1answer
105 views

Multibyte CString to Unicode MFC

I have 2 MFC projects. A library project uses Multi-byte Character set. An executable project uses Unicode Character set. I only wrote the library project and have to use it in the executable. ...
0
votes
0answers
113 views

c++ heap corruption detected in local CString assignment

I am writing a multithread program: I created a thread to take image from a camera and update the picture element in user interface. I then created a CString to set image file name and then save it to ...
0
votes
2answers
153 views

Heap corruption error with delete []

So I'm a pretty big new at C++, so I'm sure this is a relatively simple problem, but I have a legacy C++ app I'm trying to trace a heap corruption problem and have traced it to this function: void ...
2
votes
1answer
334 views

MFC C++ How do I display a const char value in MessageBox?

I hope that the title was good enough to help explain what is needed. After solving this much of my project should be done. When I did this char e[1000] = "HELLO"; CString msg; ...
0
votes
2answers
188 views

How to convert CString to CByteArray?

I know that converting CByteArray to CString is pretty straightforward. But how do I do it the other way around - from CString to CByteArray?
1
vote
1answer
168 views

MFC CString Linker error between two projects

I have 2 projects in c++ (MFC) One is a library project which im using in the second one (an executable one). They work together great, until I call a function from the regular project that takes a ...
1
vote
1answer
156 views

Having trouble concatenating CStrings in an MFC calculator application

void CcalculatorDlg::OnBnClickedButton1() { CString grabData = _T(""); m_display.GetLine(0,grabData.GetBuffer(10),10); grabData += _T("1"); ...
0
votes
0answers
218 views

In MFC, how to I read in an edit control as a character array?

Right off the bat, here is my code: void CRealFitnessDlg::OnBnClickedMfcbutton1() { //create vectors and iterators std::vector<char[256]> weights; std::vector<char[256]> ...
0
votes
1answer
77 views

How to manipulate CString's content [closed]

guys, I have a problem, please help me! I have a CString variable which will receieve from Database,and the data may like this:(8)(9)(10)(11) or more. Now I want to change every number in CString,for ...
0
votes
1answer
213 views

MFC CString “find” return code, microsoft site is down

The URL http://msdn.microsoft.com/en-us/library/aa314323(v=vs.60).aspx is not working for me so i cant read about it. If anyone can help me, when trying to find a char in a CString (e.g int ...
0
votes
1answer
573 views

Convert CString to LPTSTR and LPCTSTR

If CString to LPCTSTR (const), cast it directly. Am I correct? If CString to LPTSTR, call GetBuffer() and ReleaseBuffer() between the block that use the LPTSTR variable. Am I correct?
1
vote
4answers
312 views

Compare two CString which contain Version no

In a code I have 2 CString which contain a part of version number, First exe contain version 1.1234.3.1 and the second exe has version 1.2.3.1. Code should be such that Suppose CString ...
0
votes
2answers
2k views

How to convert CString to const char*?

i want to convert CString to const char*, i used that const char* cstr = (LPCTSTR)CString; but it doesn't compile,so how to do that, or how to convert CString to double, i used this method _tstof but ...
0
votes
2answers
99 views

stl map const_iterator and g++ error

I'm trying to port some windows"s MFC class to linux because I have to port a windows software to linux. here is the code I need to port 165: SMapCI it = _s$.find("nchairs"); 166: if ...
0
votes
4answers
341 views

Extract a floating point number from a CString

I want to extract a floating point number from a CString formatted as: (example extract 22.760348) Incidence_angle(inc)[deg] :22.760348 Basically I am reading a plain text file ...
1
vote
3answers
530 views

CString::Format() causes debug assertion

Cstring::Format causes debug assertion in visual studio 2008 at vsprintf.c line 244 with "buffer too small". //inside the function. somefile.Open (//open for mode read) //somefile is CFile. char* ...
0
votes
1answer
166 views

Failed to assign an Ansi char array to MFC CStringW

I have an Ansi char array like and want to initialize a CStringW (WCHAR specialization of CString template). But the CString object does not have copy the chars from the array. CStringW sSample = ...
0
votes
4answers
2k views

Need to delete CString after use to free memory?

If I am using a CString like this: void myFunc(char *str) { CString s(str); // Manipulate other data with CString // ... // Finished // Should I somehow delete 's' here to avoid a memory ...
-1
votes
1answer
255 views

set containing a class with CString member variables stores only first letters

I am working with MFC and I have this class: class CUnit { private: CString name; CString init; CString chp; CString rhp; CString condition; public: CUnit(void); ...
-1
votes
2answers
882 views

Conversion of CString to float

Some body help me regarding to the following problem strFixFactorSide = _T("0.5"); dFixFactorSide = atof((const char *)(LPCTSTR)strFixFactorSide); "dFixFactorSide" takes value as 0.0000; How I ...
-1
votes
1answer
191 views

Exception error in CStringData GetData() in MFC

In my function, Im assignning one Global CString to varaible declared in header file.But it shows unhandled exception error. My code CString sReceiceStr = _T(""); //Global variable void ...
2
votes
3answers
392 views

CString construction from std::string - copy chars or pointer

If I convert a std::string into a CString using something like: std::string ss("Foo"); CString cs( ss.c_str() ); Does the CString copy the characters from ss or does it simply copy the char* ...
0
votes
3answers
347 views

How to convert CString to UCHAR array?

I have a cstring object str = "5043", now i want to convert to Hex and put it in UCHAR array like UCHAR sample[2]; Sample[0] = 0X50 Sample[1] = 0X43 How can i do this? please advice me
2
votes
3answers
765 views

Why does MFC C++ CString(const char*) completely changing const char* value?

I hope the title was good enough to help explain what I am having problems with. I think once I solve this problem my project will be pretty much finished. Just a note, both projects are compiled ...
0
votes
7answers
174 views

What is the internal structure of an object of the (EDIT: MFC) CString class?

I need to strncpy() (effectively) from a (Edit: MFC) CString object to a C string variable. It's well known that strncpy() sometimes fails (depending on the source length **EDIT and the length ...
0
votes
2answers
1k views

How do I convert a wParam to a CString?

I have a pMsg->wParam from a WM_KEYDOWN message, and I want to convert it into a CString. How can I do that? I have tried the following code: TCHAR ch[2]; ch[0] = pMsg->wParam; ch[1] = ...
0
votes
1answer
309 views

Extract CString between tags

How can I extract a CString between two tags ? <tag1>My Text</tag1> I don't want to calculate the start and end position then use Mid, maybe there is another easier method using STL ?
0
votes
1answer
168 views

AfxBeginThread() + Cstring = garbage content

Please help me understand what is wrong with my code. Header File typedef void (*pStatusCallback)(UINT code, const CString& message); class CComunicator { private: CUT_WSClient _client; ...
0
votes
2answers
554 views

strange behavior with MFC's CString

I am getting the strangest memory behavior using an MFC CString: line 138: PCD_Dir = m_pRunPCD->m_PCD_Dir; declarations: CString PCD_Dir; (file scope, defined as a global outside of ...
2
votes
1answer
409 views

How do I swap an MFC CString?

OK, so I'm all sold on the copy-and-swap idiom and I think I mostly know how to implement it. However, or codebase uses MFC's CString class as string and this ain't gonna change. Since swap must ...
1
vote
3answers
2k views

Conversion from CString to char*/TCHAR*

I am well aware of techniques to convert CString to a C-style character. One of them is to use strcpy/_tcscpy, and others include using CStrBuf. The problem: char Destination[100]; CStringA Source; ...
0
votes
4answers
871 views

CString Parsing Carriage Returns

Let's say I have a string that has multiple carriage returns in it, i.e: 394968686 100630382 395950966 335666021 I'm still pretty amateur hour with C++, would anyone be willing to show me how you go ...
0
votes
2answers
1k views

LPBYTE data to CString in MFC

I am encrypting data using CryptProtectData function and I am getting encrypted data in LPBYTE format, I want to save that data into a file and then read back for decryption. In order to write string ...
0
votes
2answers
302 views

How to convert UCHAR to Binary

I want to know how to convert a UCHAR array to a binary string in C++/MFC. I tried some of the possibilities with Cstring but they didn't work. Please let me know why. Here is the code which I have ...
5
votes
1answer
2k views

How do I convert an ATL/MFC CString to a QString?

Given the encoding of the project is probably Unicode (but not for sure) what is the best way of converting ATL::CString to QString? What I have thought of is this: CString c(_T("SOME_TEXT")); ...
1
vote
1answer
2k views

CEdit Text Retrieval in mfc

I am using CEdit with the property of Multiline.My objective is to retrieve the individual line and place it in my CStringArray. While retrieving the line using GetLine , I have to know the string ...
4
votes
4answers
4k views

MFC: std::string vs CString?

Using C++ with MFC. Coming from a C# background I typically just use string for all, well, strings. I use them for class members, method parameters, and method return values. Now in C++ I've got ...
1
vote
4answers
1k views

Is a CString always null-terminated?

From the CString interface, clearly one should not assume that a CString is null-terminated. However, it seems that sometimes there is, in fact, a null character at the end of the string. Is it ...
1
vote
1answer
492 views

Interpreting App Verifier output: Heap corruption or misinterpreting stack address as heap address?

We have a test case that crashes our big MFC-based app with a heap corruption error. I turned on the page heap using App Verifier for the DLL in question (turning the heap on for the entire process ...
0
votes
4answers
2k views

MFC CString Format gives weird behaviour

I am having a weird problem with CString I have the following code which gives an unexpected result: CString sourcePath = _T("C:\\some\\path\\file.ext"); CString log; log.Format(_T("Path = %s"), ...
0
votes
2answers
1k views

How to serialize a CString using boost

I'm trying to use boost::serialization to replace one part of an existing project that implements its own methods for serialization but are not that good. However, I'm facing some problems because the ...
0
votes
2answers
510 views

CString Format problem and differences in Windows XP and 7?

There is a problem, below code works for Windows 7 and not for Windows XP? By any chance, do you know the reason for that? Thanks in advance. I have checked that it is not a DB error. For Win 7 it ...
0
votes
1answer
1k views

Convert OLECHAR* to CString in VC++?

How to convert OLECHAR* to CString in VC++ ?
0
votes
1answer
137 views

std::map crappy chars only in release mode

I have an std::map as parameter for an function and in Debug Mode (VS2008) the map have the correct keys and values, but when I start the program in Release there are crappy chars in to the map! Code ...
0
votes
2answers
262 views

Using CString to Convert int and Send to Console

My console application attempts to write an integer to the console: int i = 170; CString cs; cs.Format( L"%d", i ); wcout << cs << endl; I expect "170" to be written to the console, but ...
7
votes
3answers
2k views

C++ CString equivalent in C#

What is the C# equivalent for MFC's CString?
0
votes
1answer
459 views

boost regex search fails with MFC CString

I having an issue in using Boost regex with a MFC CString. The regex is very simple: it must check if the string ends with the name of a dll I am looking for. In the code below the CString Path DOES ...

1 2
15 30 50 per page