Re: Read a textfile to an array
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Sat, 09 Apr 2005 22:22:50 -0700
"JP" <JP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>Hi; I need some help with writing a member function really badly. I have a
>template class with the constructor as follows:
>
>//constructor
>
>template <class T>
>MyClass<T>::MyClass(int s)
>{
> size = s;
> T array = new T[size];
>}
>
>//member function prototype
>
>template <class T>
>void MyClass<T>::ReadFile(char *file){};
>
>sombody please help me define the member function so that it will accept a
>filename and then it reads the file and then add the values to the array that
>was created by the constructor.
Is this a homework assignment?
Are the contents of the file supposed to be stored into the array you
already have, or do you need to add additional space? Reading into the
existing array is trivial. What do you already have?
--
- Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc
.
- References:
- Read a textfile to an array
- From: JP
- Read a textfile to an array
- Prev by Date: Re: recreate a thread
- Next by Date: Re: Read a textfile to an array
- Previous by thread: Re: Read a textfile to an array
- Next by thread: Re: Read a textfile to an array
- Index(es):
Relevant Pages
|