Re: formattedRead and whitespace-separated variables

2013-04-09 Thread Joseph Rushton Wakeling
On 04/09/2013 07:09 PM, Ali Çehreli wrote: > Yes it is tolerant. A single space in the format strings reads and ignores all > white space at that spot. Forgot to say thank you! This is useful to know. :-)

Re: formattedRead and whitespace-separated variables

2013-04-09 Thread Joseph Rushton Wakeling
On 04/09/2013 07:09 PM, Ali Çehreli wrote: > I suggest you put a space before the first %s as well. I actually strip the leading/trailing whitespace from the line before this point, so it should be unnecessary.

Re: formattedRead and whitespace-separated variables

2013-04-09 Thread Ali Çehreli
On 04/09/2013 04:42 AM, Joseph Rushton Wakeling wrote:> Hello all, > formattedRead(s, "%s %s %s", &var1, &var2, &var3); > > ... but is this tolerant of arbitrary differences in the whitespace between > variables? (e.g. it might be 2 spaces not 1; or a tab; or ...) Yes it is tolerant. A s

formattedRead and whitespace-separated variables

2013-04-09 Thread Joseph Rushton Wakeling
Hello all, A bit of a naive question here as text processing isn't my forte ... Suppose I have a data file containing whitespace-separated variables, i.e. 1 2 3 4 5 6 7 8 9 10 11 12 ...etc. Naively it's easy to do something like (having got a stripped string of the line),