From: Nicolas C. <war...@fr...> - 2004-01-26 12:50:25
|
[...] > > Other case : if you have a file containing N strings of X characters > > separated by \0 , then reading 3 strings will give you a position of > > 3*(X+1) - including the \0 separator. It's difficult to add a concept of > > "length" and "pos" on such tokens , although it's very easy to do in the > > case ('a,'a list) input. > > So in this example you have an object of type > (string, string list) input. Physically, the different strings are > stored in a file separated by \0. But for the abstract interface this > is irrelevant. In your example, if you read 3 strings then pos should > return 3, /not/ the sum of the lengths of the individual strings, and if > you do a "seek in 14" then the implementation should go to the start > of the 15th string in the file. I agree with that, this is the correct behavior for a (string,string list) input, but what about a (char,string) input ? pos/seek should be expressed in the smallest unit of the two parameters ( char ). And here it's getting confusing because the \0 string separator is also a char. Nicolas Cannasse |