Quote:
Originally Posted by xpi0t0s View Post
The approach I often use is to scan the string with a for loop and use a state variable which determines where we're up to in the source string, then to decode the string and assign appropriate values to appropriate members of the structure within a switch. But it depends very much on the structure of the string, if it contains, say, "a=1,b=2,c=3" and this means assign 1 to a, 2 to b and 3 to c then you don't really need much of a state machine at all. Can't really say much more than that due to the vagueness of the question.

Can you give an example string (make it a short one, less than 30 characters but containing 3-4 data items that need assigning), and structure, and what should be assigned to what, and I'll consider having a go at presenting an example of how I might do it.



Hi,
the string read from file will be like ACM.IODATA.DI.DI1WORD3.T4 and it has to be converted to structure variable.