Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Motwner

converting to a constant

This topic is 6182 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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 ?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!