octave-maintainers
[Top][All Lists]
Advanced

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

pipe() function in syscalls.cc


From: John W. Eaton
Subject: pipe() function in syscalls.cc
Date: Thu, 10 Oct 2002 21:12:01 -0500

On 10-Oct-2002, Steve Lipa <address@hidden> wrote:

| Dear Octave-maintainers:
| 
| First, let me apologize if this is a stupid question!
| 
| Could someone please give me a hint where to find the
| routine in the Octave source code that is responsible for
| printing out the numbers indicated below?
| 
| ( I am using version 2.1.36 )
| 
| octave:1> x = pipe
| x =
| (
|   [1] =
|   {
|     id = 4       // I WANT THIS ONE
|     name = 
|     mode = r
|     arch = native
|     status = open
|   }
|   [2] =
|   {
|     id = 3       // I WANT THIS ONE
|     name = 
|     mode = w
|     arch = native
|     status = open
|   }
| )

The pipe function is defined in syscalls.cc.  The elements of the list
are octave_file objects.  The code that prints the data in that object
is defined in the function octave_file::print_raw in ov-file.cc.

| So far I haven't been able to figure out a way to assign these
| numbers to a variable (using something like nth(x,2).id). Everything
| I try seems to displease Octave.

Why do you need the number?  It's probably best to just pretend that
the octave_file object is special and just pass it around to functions
that expect to handle file objects (fprintf, fscanf, fread, etc.).

But, if you really need it, if a file object is used in numeric
contexts, it is automatically converted to a number, so something like

  nth (x, 1) + 0

should do what you want (but I would still like to know why you need
to have the number -- maybe it would be useful to have a fileno()
function).

jwe



reply via email to

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