Object Positions

Hey guys/girls,

I've got a serious brain block on the part thats supposed to think when i hack code into a file. So here's what i want to achieve.

I've got a file that contains X,Y,Z data as well as string that tells me which kind of volume it is (sth like a description). I'll be honest I'm coming from Flash AS3 coding, which is much more intuitive to me. There I just would have done something like Object[i].x, Object[i].y, Object[i].z, Object[i].voi for all values in that file but just cant figure out how to do this in C (not C++).

Anyone got an idea? I was thinking struct might work, but to be honest, I don't know how to connect an array of those objects derived from that struct to the information that i get out of the file.

Thanks!!!
Last edited on

Define the object type

1
2
3
4
5
6
7
struct objectType
{
  int x;
  int y;
  int z;
  std::string voi;
}


Make an array of them

objectType Object[100];


Play with values

1
2
Object[74].x = 7; 
Object[21].voi = "BeansOnToast"; 
Topic archived. No new replies allowed.