making dynamic array 
Author Message
 making dynamic array

I don't know exactly what you want to do but if you really want to construct
an array of CString, one of the easiest way is to use CArray. It has member
functions to add elements ou set the array size dynamically.

Steve


Quote:
> Hi,
> I just figure it out how to read file line by line,
> I would like to know how do I store that value into dynamic CString or
char*
> array.

> Could anyone tell me how to declare dynamic array?
> I read value like this.

> ifstream fInput( "text.txt" );
> if ( fInput.is_open() )
> do
> {
>     //....
>     fInput.getLine( temp, 255 );
>     //... I need to store temp value into dynamic array!!!!
> }while ( !fInput.eof() )

> Thanks in advance.
> Peter,




Fri, 11 Jan 2002 03:00:00 GMT  
 making dynamic array
Hello again Grumbler,

There are several different methods you could use.

If you are using MFC the simplest would probably be to use a CStringArray
object. There are many other MFC collection templates and classes to choose
from.

If you want to stay away from MFC, for whatever reason, the STL vector
template would work well. There are other STL collection templates as well.

You could even allocate your own array elements and manage the memory. Not
usually done these days.

Hope this helps.

Pete Albano
Vice President Software Engineering, Kostech Corp.
http://informedinvestor.com

Quote:

>Hi,
>I just figure it out how to read file line by line,
>I would like to know how do I store that value into dynamic CString or
char*
>array.

>Could anyone tell me how to declare dynamic array?
>I read value like this.

>ifstream fInput( "text.txt" );
>if ( fInput.is_open() )
>do
>{
>    //....
>    fInput.getLine( temp, 255 );
>    //... I need to store temp value into dynamic array!!!!
>}while ( !fInput.eof() )

>Thanks in advance.
>Peter,




Fri, 11 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Q: making dynamic array

2. Dynamic arrays not really dynamic in managec C++?

3. How to inspect dynamic array ( my_struct* array) ?

4. Control Arrays/Dynamic Arrays

5. Lists VS. Dynamic Arrays VS. Re-defining Arrays

6. COBOL making dynamic call to c function under OS/390

7. Making Dynamic libraries in C.

8. HELP -> dynamic array of char** in dynamic array of mystruct**

9. Newbie question: Making arrays bigger

10. making pointers to structure elements using array elements

11. Making array of structs available to functions

12. making arrays of pointers with pointers.....

 

 
Powered by phpBB® Forum Software