| |

VerySource

 Forgot password?
 Register
Search
View: 741|Reply: 8

Urgent !!! Why can't the program compiled by everyone help, thank you !!!

[Copy link]

5

Threads

17

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-2-12 01:30:01
| Show all posts |Read mode
Why isn't it possible? I was anxious, because I was a beginner and couldn't adjust it for a few days.
Which hero helped me look at my program

CString str = "a # bc # dfgh # e";
CString str1, str2, str3, str4;
CStringArray StrArray;

void CMy30Dlg :: dispach ()
{
AfxExtractSubString (str1, str, 0, '#'); / str1 = "a"
AfxExtractSubString (str2, str, 0, '#'); / str2 = "bc"
AfxExtractSubString (str3, str, 0, '#'); / str3 = "dfgh"
AfxExtractSubString (str4, str, 0, '#'); / str4 = "e"
Ranch

StrArray.Add (str1);
StrArray.Add (str2);
StrArray.Add (str3);
StrArray.Add (str4);
}

// I took the strings separated by # signs, put them in str1, str2, str3, str4, and put them in StrArray

void CMy30Dlg :: display ()
{
         UpdateData ();
m_fre = StrArray.GetAt (1);
m_bw = StrArray.GetAt (2);
m_sen = StrArray.GetAt (3);
m_hop = StrArray.GetAt (4);
          UpdateData (false);

}

// m_fre, m_bw, m_sen, m_hop are the four CString variables that I associate with the Edit control. In this function, I want to display the four saved characters in the four edit edit boxes.

What's wrong ????
Anxious! Thank you
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-9 15:30:01
| Show all posts
m_fre = StrArray.GetAt (0);
m_bw = StrArray.GetAt (1);
m_sen = StrArray.GetAt (2);
m_hop = StrArray.GetAt (3);
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-9 17:15:01
| Show all posts
Your boundary is wrong, and your dispach () function has a problem
Reply

Use magic Report

5

Threads

17

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 Unknown

 Author| Post time: 2020-4-9 19:15:01
| Show all posts
Um, thank you, I will look at it again, if you have any expert, please continue to give advice, I really appreciate it !!!
Reply

Use magic Report

0

Threads

32

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 Invalid IP Address

Post time: 2020-4-9 21:30:02
| Show all posts
After trying it out, the steps on the AfxExtractSubString should be changed to the following:
AfxExtractSubString (str1, str, 0, '#'); // str1 = "a"
AfxExtractSubString (str2, str, 1, '#'); // str2 = "bc"
AfxExtractSubString (str3, str, 2, '#'); // str3 = "dfgh"
AfxExtractSubString (str4, str, 3, '#'); // str4 = "e"
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-4-9 22:30:01
| Show all posts
AfxExtractSubString (str1, str, 0, '#'); // str1 = "a"
AfxExtractSubString (str2, str, str1.GetLength (), '#'); // str2 = "bc"
AfxExtractSubString (str3, str, str2.GetLength (), '#'); // str3 = "dfgh"
The
str4 = str.Mid (str1.GetLength () + str2.GetLength () + str3.GetLength () + 3);
Reply

Use magic Report

0

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-10 00:30:01
| Show all posts
You lack the most basic care :)
Reply

Use magic Report

5

Threads

17

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-4-10 14:00:01
| Show all posts
AfxExtractSubString (str1, (LPCTSTR) str, 0, '#'); // str1 = "a"
AfxExtractSubString (str2, (LPCTSTR) str, 1, '#'); // str2 = "bc"
AfxExtractSubString (str3, (LPCTSTR) str, 2, '#'); // str3 = "dfgh"
AfxExtractSubString (str4, (LPCTSTR) str, 3, '#'); // str4 = "e"
The
After this change, it still doesn't work :(
Reply

Use magic Report

5

Threads

17

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

 Author| Post time: 2020-4-10 19:15:01
| Show all posts
Thank you very much !!!
         AfxExtractSubString (str1, str, 0, '#'); // str1 = "a"
AfxExtractSubString (str2, str, 1, '#'); // str2 = "bc"
AfxExtractSubString (str3, str, 2, '#'); // str3 = "dfgh"
AfxExtractSubString (str4, str, 3, '#'); // str4 = "e"
Is that all right ???

Why am I still not showing it? Compilation is passed!
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