| |

VerySource

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

Help: Add strings

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-23 10:00:01
| Show all posts |Read mode
CString s1;
GetCurrentDirectroy (_MAX_DIR, s1.GetBuffer (_MAX_DIR));
CString s2 = "s" + s1;
Debugging found: s1 is a path, assuming "f;\test", but s2 = "s" + s1, but it is equal to "s", which means that s1 is not added! what happened? Confused.
Reply

Use magic Report

1

Threads

15

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-7-2 08:15:01
| Show all posts
Is s1 not empty?
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-7-2 12:00:02
| Show all posts
Ok, all printed out. So strange
Reply

Use magic Report

0

Threads

45

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-7-3 15:30:01
| Show all posts
Is there something in s1?
After s1.GetBuffer(), don’t you want ReleaseBuffer?
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Taiwan

Post time: 2020-7-3 17:15:01
| Show all posts
Add before adding
s1.ReleaseBuffer();
Reply

Use magic Report

0

Threads

30

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-7-3 19:00:01
| Show all posts
Positive solution upstairs!
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-7-4 11:00:01
| Show all posts
GetCurrentDirectroy

You seem to be wrong, it should be this:

GetCurrentDirectory
Reply

Use magic Report

2

Threads

19

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-7-5 10:15:01
| Show all posts
CString s1;
GetCurrentDirectory(_MAX_DIR,s1.GetBuffer(_MAX_DIR));

CString s2;
s2.Format("s%s",s1);
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