converting to a constant

Started by
4 comments, last by Motwner 22 years, 3 months ago
I have been working on a simple program that reads a number from a text file and then implements that number into an array bracket... example: File>>chOut; scanf(chOut,"%d",&tri); TRI*TRIptr[tri]; The problem is that ''tri'' must be a constant, right? Please show me how to convert tri to a const. Thank ya... -Later
Advertisement
File>>chOut;
scanf(chOut,"%d",&tri);
TRI*TRIptr[tri];
LE SCRUB
eh sorry about the above ...anyways....

scanf(chOut,"%d",&tri); im gathering is actually "sscanf"

TRIptr[tri]; should be fine for referencing
but the whole line "TRI*TRIptr[tri];"

doent make much sence TRI = TRIptr[tri] would.
what are you trying to do here ?

LE SCRUB
sorry for the lack of info.

TRI is acually a class. You see I''m working on a very simple glut engine. TRI stands for triangles. I''m reading in how many triangles the engine must make. Every time I run the program, an error tells me that ''tri'' must be constant. Is there any way possible I can convert the integer ''tri'' to a constant?

sorry for the lack of info.

TRI is acually a class. You see I''m working on a very simple glut engine. TRI stands for triangles. I''m reading in how many triangles the engine must make. Every time I run the program, an error tells me that ''tri'' must be constant. Is there any way possible I can convert the integer ''tri'' to a constant?

going by that then you should have something like

  TRI *triangles;File>>chOut;scanf(chOut,"%d",&tri);triangle = new TRI[tri];  


should work ..

though I still dunno what "TRI*TRIptr[tri];" is suppose to do ?
LE SCRUB

This topic is closed to new replies.

Advertisement