473,320 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MFC CString problem

6
To get the proper idea of my problem, I think it would be best to show you a part of my code:

void some_function(CEdit x, CString t)
{
CString w;
//some code
if ( t[0] == 0x0A)
w=0x0D; //this is the line where I get the error
}

When I try to compile the code, I get the error:
"error C2593: 'operator =' is ambiguous"
I don't really know how to deal with this kind of problem, since I have another program that uses the same code, and it doesn't have any problem. I think I should include some special header for this, but I really can't figure which one.
Please I need help in this matter!
Dec 11 '06 #1
3 3100
willakawill
1,646 1GB
To get the proper idea of my problem, I think it would be best to show you a part of my code:

void some_function(CEdit x, CString t)
{
CString w;
//some code
if ( t[0] == 0x0A)
w=0x0D; //this is the line where I get the error
}

When I try to compile the code, I get the error:
"error C2593: 'operator =' is ambiguous"
I don't really know how to deal with this kind of problem, since I have another program that uses the same code, and it doesn't have any problem. I think I should include some special header for this, but I really can't figure which one.
Please I need help in this matter!
Hi, your problem is with the code on the line before using t[0]
Dec 11 '06 #2
nd3r
6
Hi, your problem is with the code on the line before using t[0]
Nope!
If I try:
if(t[0]==0x0A)
{}
it works!
So the problem is not there.
And btw t is a reference variable.
i will paste my code to show you the exact function.

void CRSADlg::WriteOnScreen(CEdit t, CString &str)
{
CString winStr;

t.GetWindowTextW(winStr);
t.SetSel(winStr.GetLength(),winStr.GetLength());

winStr="";
if(str[0] == 0x0A)
winStr = 0x0D;

winStr+=str;
t.ReplaceSel(winStr);
}
Dec 11 '06 #3
nd3r
6
I found something and it works, but I don't know exactly if it is correct to use:
if I typecast the hex, I don't have any problem ( winStr=(char)0x0D ).
Dec 11 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Markus Hämmerli | last post by:
I ' ll tra to convert a Cstring to char* without success. I working in a Unicode enabled environment this is working in Unicode CString source = _T("TestString"); TCHAR *szSource =...
8
by: Oskar | last post by:
Hi. I`m new in cpp and i have a litlle problem. i have a CString from Edit Box (eg."aaa bbb ccc 7327373 d feaf 323 dvjiv 234") and i want to put the data (space separated) into an array.It shuld...
9
by: Fausto Lopez | last post by:
I'm getting the following error: 'strlen' : cannot convert parameter 1 from 'class CString' to 'const char *' when I try to compile the following code: HRESULT AnsiToUnicode(CString pszA,...
5
by: Tim Wong | last post by:
All: I am trying to convert a CString value to an unsigned char array. I found some code online that will allow me to compile, but when I try to print out...i get a whole mess. /*Begin Code*/...
3
by: nsyforce | last post by:
What is the correct way to convert a const char* to a CString? I'm somewhat of a newbie and have tried several ways. While they all convert ok, I'm using a profiler that shows a memory leak for...
25
by: Gareth | last post by:
I want to do the following to strings: 1) Check if first four characters are "DATA" 2) Get the middle 'word' from the following string "DATA 123 xyz" (the middle word is variable length) -...
4
by: huguogang | last post by:
Just curious, any one know what the 3 part parameter "class CString filename" would mean. The code: int TestFunc(class CString filename) { fopen(filename, "w"); } Compile using Visaul C++,...
0
by: skysurf | last post by:
Hello, I have been placed on a new project involving development for Windows CE using Visual C++. I have to send an XML file via a SSL connection to a server followed by receiving a corresponding...
4
by: Cactus | last post by:
How to convert unsigned char* to CString: I wrote some function: u_char_ =55; u_char_ =66; u_char_ =77; .........=ii...... Convert_to_CS(u_char_);
2
by: flyingxu | last post by:
Hi, I run into a cstring related link problem in VC7. My solution has 3 projects, one MFC exe, two MFC extersion DLL. the two MFC extersion DLL export functions which use CString as parameters....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.