From bug-octave-request at bevo dot che dot wisc dot edu Sun Jan 5 15:29:04 2003 Subject: Error in fscanf %i and %f for pipes From: Bruce Moore To: bug-octave at bevo dot che dot wisc dot edu Date: Sun, 5 Jan 2003 13:28:41 -0800 (PST) When reading from a pipe, fscanf does not correctly interpret the %i and %f formats on 2.1.39. A test script is fh = popen("cat test.dat","r") [i1,i2,i3] = fscanf(fh,"%i %i %i\n","C") tval = i1*i2 [s1,s2,s3] = fscanf(fh,"%s %s %s\n","C") i1 = str2num(s1); i2 = str2num(s2); tval = i1*i2 pclose(fh) Data file is 1 2 3 4 5 6 7 8 9.0e3 output is octave:22> test fh = { id = 7 name = cat test.dat mode = r arch = native status = open } i1 = [](0x0) i2 = [](0x0) i3 = [](0x0) tval = [](0x0) s1 = 2 s2 = 3 s3 = 4 tval = 6 ans = 0 octave:23> The actual pipe command that I'm using is a PERL script to run SQL statements against a DB2 database. The "cat" command is just an easy test case. ===== Bruce Moore __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------