converting TCHAR to CString giving some garbage value
-
Hi all, I have made a application in vc2008, I have made a TCHAR variable...
TCHAR prdcode[10];
My problem is i want to assign this value to CString variable...
CString test = prdcode;
but while assigning value it takes some garbage value.... how can i do it... thanks in advance
-
Hi all, I have made a application in vc2008, I have made a TCHAR variable...
TCHAR prdcode[10];
My problem is i want to assign this value to CString variable...
CString test = prdcode;
but while assigning value it takes some garbage value.... how can i do it... thanks in advance
VCProgrammer wrote:
but while assigning value it takes some garbage value....
How do you check that ? In oyur code snippet, you didn't assign anything to prdcode, so it will contain garbage at that time. Show use the code where you write something in it.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
Hi all, I have made a application in vc2008, I have made a TCHAR variable...
TCHAR prdcode[10];
My problem is i want to assign this value to CString variable...
CString test = prdcode;
but while assigning value it takes some garbage value.... how can i do it... thanks in advance
TCHAR prdcode[10] = _T("thisvalue");
CString test = prdcode;«_Superman_»
-
TCHAR prdcode[10] = _T("thisvalue");
CString test = prdcode;«_Superman_»
-
VCProgrammer wrote:
but while assigning value it takes some garbage value....
How do you check that ? In oyur code snippet, you didn't assign anything to prdcode, so it will contain garbage at that time. Show use the code where you write something in it.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++my prcode is getting a value.... and i am assigning that value to my CString variable.... suppose it has 10 characters starting will be ok but at end it'll show garbage value....
-
my prcode is getting a value.... and i am assigning that value to my CString variable.... suppose it has 10 characters starting will be ok but at end it'll show garbage value....
VCProgrammer wrote:
my prcode is getting a value....
Well, where is your code ? Without code, it's difficult to help...
VCProgrammer wrote:
starting will be ok but at end it'll show garbage value....
Did you forget the zero termination of the string ?
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
Hi all, I have made a application in vc2008, I have made a TCHAR variable...
TCHAR prdcode[10];
My problem is i want to assign this value to CString variable...
CString test = prdcode;
but while assigning value it takes some garbage value.... how can i do it... thanks in advance
Well, possibly
prdcode
contains garbage, you didn't show us how did you fill the array content... :rolleyes:If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi all, I have made a application in vc2008, I have made a TCHAR variable...
TCHAR prdcode[10];
My problem is i want to assign this value to CString variable...
CString test = prdcode;
but while assigning value it takes some garbage value.... how can i do it... thanks in advance
VCProgrammer wrote:
...it takes some garbage value....
How are you verifying this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons