473,505 Members | 13,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

only first character is displated from string

4 New Member
hi all,
I have developed a console application with MFC and unicode supported using Visual studio.net 2003.
The problem I have is that the output stream is displaying only the first character in the string rather than the whole string. see below:

CString str = _T("14.50.00");
TRACE("start time is : %s\n" str);

the output comes out as : start time is :1

Can any one help?
thanks
May 11 '07 #1
5 2931
AdrianH
1,251 Recognized Expert Top Contributor
hi all,
I have developed a console application with MFC and unicode supported using Visual studio.net 2003.
The problem I have is that the output stream is displaying only the first character in the string rather than the whole string. see below:

CString str = _T("14.50.00");
TRACE("start time is : %s\n" str);

the output comes out as : start time is :1

Can any one help?
thanks
I'm surprised you got that far ;). (you are missing a comma between the end quote and str).

Assuming that the missing comma is a typing error, it could be that you are using a UNICODE string in a non-UNICODE enviroment. In fact, I don't think that the TRACE system even recognises UNICODE strings.


Adrian
May 11 '07 #2
manu99
4 New Member
I'm surprised you got that far ;). (you are missing a comma between the end quote and str).

Assuming that the missing comma is a typing error, it could be that you are using a UNICODE string in a non-UNICODE enviroment. In fact, I don't think that the TRACE system even recognises UNICODE strings.


Adrian
Thanks Adrian.
I have set the project properties to Use Unicode Character Set so I think the environment is ok. I have tried using printf rather than TRACE and I still get the same problem.
May 11 '07 #3
AdrianH
1,251 Recognized Expert Top Contributor
Thanks Adrian.
I have set the project properties to Use Unicode Character Set so I think the environment is ok. I have tried using printf rather than TRACE and I still get the same problem.
Use wprintf() for unicode.


Adrian
May 11 '07 #4
manu99
4 New Member
Problem was fixed by adding the "L" symbol infront of the string ehich is used for wide character strings.
May 11 '07 #5
AdrianH
1,251 Recognized Expert Top Contributor
Problem was fixed by adding the "L" symbol infront of the string ehich is used for wide character strings.
Then something is wrong with the defintions of _T(). It is a macro that is to put the leading L in for you if you have set up the Unicode settings correctly.


Adrian
May 11 '07 #6

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

Similar topics

8
5451
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
5
3254
by: Mike Murray | last post by:
Hi I have the following issue. I have a character that is return by a SQL Server database "É" to be precise, the issue is that when I store character in a .net string variable my understanding...
53
3938
by: ROSY | last post by:
hello, response if u ,on all level of questions::: 1.how a self deletable .exe file deleted on some future date & time without invoking the .exe itself? 2.if we want that any wildcard...
15
2259
by: Beeeeeves | last post by:
Is there a quick way to find the index of the first character different in two strings? For instance, if I had the strings "abcdefghijkl" and "abcdefxyz" I would want the return value to be...
17
3443
by: Yogi_Bear_79 | last post by:
I have the following code: sscanf(line, "%d", n_ptr) !=1 || n_ptr <=0; It only partially works. If the user types a character other than 0-9 to start the string it fails. However as long as...
7
15275
by: bcpkh | last post by:
Hello All I need to check a string to make sure it does not contain any non numeric characters, the problem that I face is that the string is fairly long, 2784601121574585949, strtol etc. can't...
8
80203
by: Johny | last post by:
Let's suppose s='12345 4343 454' How can I replace the last '4' character? I tried string.replace(s,s,'r') where 'r' should replace the last '4'. But it doesn't work. Can anyone explain why?...
9
7942
by: sovht | last post by:
System: Intel, Windows XP Pro, SP2 IDE: VC++ 6.0 Problem: *Very* simple program to create a MessageBox only ever displays the first character of the given string. I checked the spec for the...
11
3613
by: coomberjones | last post by:
I have a few std::strings that I am using to store raw binary data, each of which may very well include null bytes at any point or points. I want to slap them together into a single string, so I...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.