rls@ednor.bbc.com (Reid Simpson) (06/14/91)
I'm looking for a public domain implementation of strptime(), which is to strftime() as scanf() is to printf(). Any leads would be appreciated. Reid. rls@bbc.com
guy@auspex.auspex.com (Guy Harris) (06/21/91)
>I'm looking for a public domain implementation of strptime(), which is to >strftime() as scanf() is to printf(). Any leads would be appreciated. "strptime()" isn't completely the correct solution. It "knows about" some of the items in the format string, so that it "knows" that you can leave the seconds off in a time, and the like. A better solution would have been to have: 1) a routine that parses the input string strictly, requiring matches for all fields - i.e., a *true* analog to "scanf()"; 2) a routine that gets a list of format strings, and tries them in order with the first routine until it finds one that works. 1) should be a fair bit easier to write than "strptime()"; it should be fairly straightforward, if slightly tedious, to write. 2) should add less complication than the hacks in "strptime()". I.e., if you can avoid it, don't propagate the errors in specifying the interface that I made when I first created "strptime()"; do the above instead.