strings and chars

does anyone know a way of putting this into code please? i want to read in a list of addresses as strings and set these as the input

 
string = input
 

i also want to hold the length of the string for later use

 
len = length(string)
 

i then want to use this in a switch statement

 
ch = substr(string, i-1, 1)
switch(ch)
{
//case statements
}
 

does anyone know how to do this please?

Oh yeah, go and find beginners C tutorials and forums :slight_smile: :stuck_out_tongue: :wink: :rolleyes: :smiley:

anyone with an intelligent answer?

I still fail to see the “Math”, “Algorithms”, or even “OpenGL” in all this but anyway :

  • what OS are you using ?
  • what language and librairies do you use or plan to use ? C C++ java C# python VB ?
  • more details on how you want the input : from interactive command line, in a GUI, in a pure GL window ?

its to be run on any OS. im programming in C++ using glut, writing in Visual C++. the input isnt from a command line its from an array of tesseral addresses. the point of it is to use the case statements to extract a set of coordinates from the tesseral addresses.

Don’t really see what this has to do with maths

But if your using C++ then why not simple use a standard C++ string

then wot forum should this be?

Actually it doesn’t fit in any of the forums here as it doesn’t relate to OpenGL at all.

Read UrbanLegend’s response … C++ is your friend.

if it is an array of tesseral addresses then it is to do with opengl its to do with building a 3d image from these addresses which is why he wants to get the coordinates. the whole info just was not there

Don.t know if you are still around rborob, but I think what you are asking for is efficient parsing of the string. How you input depends whether you use the command line, a file or a graphical interface. :slight_smile: