Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable object

Status
Not open for further replies.

sloopjohnc

Technical User
Nov 14, 2002
1
NL
I need to use the objects (20 Edit objects) variable in a FOR statement, like:

{
FILE *stream;
char data[8];
{
for(int i=1; i<20; i++)
{
fgets(data, 9, stream);
Edit -> Text= data;
}

The first object name is Edit1 and the next Edit2 etc. thats why I used something like Edit[1].

Thanks! Sloop.
 
By declaring:
const T_EDIT Edit[] =
{&Edit1, &Edit2, &Edit3, &Edit4, &Edit5, &Edit6, &Edit7, &Edit8, &Edit9};
(Comments:
T_EDIT is to substituted with the correct type and the Edit-objects might already be pointers, thus you have to omit the '&' before them)

you can now index by selecting &quot;Edit[index]->whatever&quot;.

This is the theory at least, have never tried it and it might be all wrong or just need some polishing to work. Totte
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top