Guest_imported
New member
- Jan 1, 1970
- 0
hi,
I am reading info from a file, and wishes to read it into
struct. MY question is how do I work with this line
-> blah* PList[100]; What can I do wit that? And lets say I want to copy that into another blah type array, how can ido it?
Also, can we use pointers to get access to private members or functions in a class?
===============================
struct blah
{ int A;
flaot B;
};
class Act
{
private:
blah* PList[100];
int Len;
public:
void ReadFileIn(istream& );
};
void Act::ReadFileIn(istream& Infile )
{ blah* Data;
Data =new blah;
while(Infile)
{
Infile>>Data->A>>Data->B;
PList[Len]=Data;
Len++;
}
=================================================
void main()
{
ifstream Infile("info.txt"
;
Act Bob;
Bob.ReadFileIn(Infile);
I am reading info from a file, and wishes to read it into
struct. MY question is how do I work with this line
-> blah* PList[100]; What can I do wit that? And lets say I want to copy that into another blah type array, how can ido it?
Also, can we use pointers to get access to private members or functions in a class?
===============================
struct blah
{ int A;
flaot B;
};
class Act
{
private:
blah* PList[100];
int Len;
public:
void ReadFileIn(istream& );
};
void Act::ReadFileIn(istream& Infile )
{ blah* Data;
Data =new blah;
while(Infile)
{
Infile>>Data->A>>Data->B;
PList[Len]=Data;
Len++;
}
=================================================
void main()
{
ifstream Infile("info.txt"
Act Bob;
Bob.ReadFileIn(Infile);