Thursday 15 March 2012

c - how do I test the format of a string? -


I have trouble matching the format of a string, the format is .rt timing which is "00:00: 01,000 -> 00: 00: 04,000 ", Hour, Minute, Seconds, Million Seconds

How do I match it to string? Here I am trying to add or subtract the time.

To calculate the values ​​of time, you want to convert string representation to integer values.

You can use numbers to read numbers from formatted strings, then multiply them together to get a millisecond value. sscanf returns the number of matches to succeed, so if the integer value less than the number of fields you expected to match is low, then you know that the string does not match your input format .


No comments:

Post a Comment