| |

VerySource

 Forgot password?
 Register
Search
View: 810|Reply: 6

How to write Redim preserve in VB in C ++

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-10 17:00:01
| Show all posts |Read mode
I want to read out some content in a file and save it in an array. The size of the array cannot be determined in advance.
In VB I use Redim preserve to increase the size of the array by 1, but what should I do in C ++? Please boss every trick
Reply

Use magic Report

0

Threads

37

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-6-2 11:15:01
| Show all posts
Dynamic array vector
Reply

Use magic Report

2

Threads

54

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-6-2 15:15:01
| Show all posts
Yes, positive solution upstairs
Reply

Use magic Report

2

Threads

54

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-6-2 16:00:01
| Show all posts
vector<T> vec;
vec.push_back(t);
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Invalid IP Address

 Author| Post time: 2020-6-3 10:45:01
| Show all posts
Do not understand vector, can malloc be used? Or use new.
Reply

Use magic Report

0

Threads

37

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-6-3 16:00:02
| Show all posts
Of course you can use new, but it’s more troublesome
Reply

Use magic Report

0

Threads

14

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-6-5 13:00:01
| Show all posts
Do not understand vector, can malloc be used? Or use new.
————————————————————————————————————————————
You explain the process of Redim preserve yourself, isn't it the implementation process of C++? ? ? ? ? ? ? ? ? ? ? ? ?
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