| |

VerySource

 Forgot password?
 Register
Search
View: 1279|Reply: 7

A type conversion problem

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 France

Post time: 2020-12-15 19:30:01
| Show all posts |Read mode
Ask how to convert a CString type to a TCHAR type array?
Reply

Use magic Report

1

Threads

12

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-12-16 02:45:01
| Show all posts
strcpy() function
CString str;
char c[256];
strcpy(c, str);
Reply

Use magic Report

0

Threads

25

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-12-16 06:15:01
| Show all posts
CString str;
str.GetBuffer(0);
Reply

Use magic Report

0

Threads

41

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-12-20 08:45:01
| Show all posts
CString str="asdadfrgdg";
char* p=new [str.GetLength()+1];
strcpy(p, str);
delete p;
Reply

Use magic Report

0

Threads

41

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-12-20 09:00:01
| Show all posts
Wrong should be
CString str="asdadfrgdg";
TCHAR* p=new TCHAR[str.GetLength()+1];
_tcscpy(p, str);
delete p;
Reply

Use magic Report

3

Threads

11

Posts

950.00

Credits

Credits
950.00

 China

Post time: 2021-2-1 10:26:09
| Show all posts
The method is different in unicode and multi-byte mode
Reply

Use magic Report

0

Threads

1

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2021-2-15 19:31:52
| Show all posts
I have studied, thank you all! !
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-5-16 01:20:12
| Show all posts
WSPRINTF can be used
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list