octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53658] Hang with fread(0)


From: Rik
Subject: [Octave-bug-tracker] [bug #53658] Hang with fread(0)
Date: Sun, 15 Apr 2018 11:02:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #53658 (project octave):

                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

This is correct.  '0' is the file descriptor for stdin, usually the keyboard.

Try this


octave:1> val = fread (0,4)
abcd
val =

    97
    98
    99
   100

octave:2> char (val)
ans =

a
b
c
d

octave:3> 


You can also use <Ctrl+D> to insert an EOF marker in to the stdin stream.



octave:3> val = fread (0)
12
34
<Ctrl+D>
val =

   10
   49
   50
   10
   51
   52
   10

octave:4> char (val)
ans =



1
2


3
4



octave:5> 


As you can see, there are a few newlines (10) values in the stream as wel, but
it is reading stdin as it is supposed to.

Closing report.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53658>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]