R
Hi folks:
I saw a message in here (I think from Curt) that relayed the old tale of how difficult string parsing in C is.
When I first embarked in this great journey called C programming, I thought the same thing. Compared to BASIC, C string handling basically sucks. Then I got to thinking "why not make my own equals to the basic commands I hold to be so
dear to my warped sense of thinking".
I am attaching a few routines that do the same things as the basic statements:
LEFT, MID, RIGHT and INSTR. With these 4 statements coded into C, string handling is now MUCH easier.
I am also including the "ini file parser" I use in my Dallas Semiconductor program. It gives a nice working example of how to implement the string functions (and parse a text file "easily" in C (TM)).
As with ALL of my code, the license is to go ahead and have fun with it. If you make any improvements, PLEASE return those improvements to me so I can improve what I have. That's it, no other requirements or restrictions.
--
Ron Gage - Saginaw, MI
([email protected])
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
I saw a message in here (I think from Curt) that relayed the old tale of how difficult string parsing in C is.
When I first embarked in this great journey called C programming, I thought the same thing. Compared to BASIC, C string handling basically sucks. Then I got to thinking "why not make my own equals to the basic commands I hold to be so
dear to my warped sense of thinking".
I am attaching a few routines that do the same things as the basic statements:
LEFT, MID, RIGHT and INSTR. With these 4 statements coded into C, string handling is now MUCH easier.
I am also including the "ini file parser" I use in my Dallas Semiconductor program. It gives a nice working example of how to implement the string functions (and parse a text file "easily" in C (TM)).
As with ALL of my code, the license is to go ahead and have fun with it. If you make any improvements, PLEASE return those improvements to me so I can improve what I have. That's it, no other requirements or restrictions.
--
Ron Gage - Saginaw, MI
([email protected])
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc