comparison test/test_io.m @ 13194:3e1871badab9

allow sscanf to accept character arrays with more than one row * file-io.cc (get_sscanf_data): New function. Flatten character arrays before extracting character data. (Fsscanf): Use it. * test_io.m: New sscanf test.
author John W. Eaton <jwe@octave.org>
date Mon, 19 Sep 2011 16:45:31 -0400
parents 38b52a073cfa
children 5fa482628bf6
comparison
equal deleted inserted replaced
13193:a00ff5cedb9b 13194:3e1871badab9
242 %% test/octave.test/io/puts-4.m 242 %% test/octave.test/io/puts-4.m
243 %!error <Invalid call to puts.*> puts (1, 2); 243 %!error <Invalid call to puts.*> puts (1, 2);
244 244
245 %!assert (sscanf ('123456', '%10c'), '123456') 245 %!assert (sscanf ('123456', '%10c'), '123456')
246 %!assert (sscanf ('123456', '%10s'), '123456') 246 %!assert (sscanf ('123456', '%10s'), '123456')
247
248 %!assert (sscanf (['ab'; 'cd'], '%s'), 'acbd');
247 249
248 %!test 250 %!test
249 %! [val, count, msg, pos] = sscanf ("3I2", "%f"); 251 %! [val, count, msg, pos] = sscanf ("3I2", "%f");
250 %! assert (val, 3); 252 %! assert (val, 3);
251 %! assert (count, 1); 253 %! assert (count, 1);