Re: Does 'seek' have to used with 'if'.....

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 15 Oct 2004, at 9:30, dirk dekker wrote:

>
>
> posted by: dirk dekker <dirk at induxion.nl>
>
> Hi,
> thanks for your answer,
> I do not understand the items. I just downloaded the samples and expected=
 to
> have a working program. But that's not true. I walked exactly the instruc=
tions
> but nevertheless : no success. Maybe you know what I am doing wrong with =
the
> isntallation of some examples.=20

This is where the confusion happens:
include file.e
i1 = seek(fn, i2)  <<== see it is assigned

Example:=20=20
 include file.e

integer fn
fn = open("mydata", "rb")
-- read and display first line of file 3 times:
for i = 1 to 3 do
    puts(1, gets(fn))

    if seek(fn, 0) then <<== no assign?

        puts(1, "rewind failed!\n")
    end if
end for

But there is an assignment made in the 2nd example, it is evaluated in the =
if
command. It's hidden. It's a concept of computer programming to pass the=

results of a function to another function without the programmer using it=

directly.

like:
trace(not(seek(fn, 0)))
puts(1,sprintf("%d",seek(fn, 0))&"\n")
set %swrk. [ $+ [ %net ] $+ . $+ [ %swrk.chan ] $+ ] .history $gettok(
%swrk. [ $+ [ %net ] $+ . $+ [ %swrk.chan ] $+ ] .history , 2- , $asc(=02) =
)


> So I noticed that to start a program I have to
> open a DOS-box. Am I right? Regards, Dirk

No. you do not haveto open any dosbox or window. But puts() to '1' is the=

dosbox, and will open a window. puts() to a file will not open a dosbox. Th=
e
windows and linux commands work differently. Look in the win32lib (or other=

windows libraries) examples for easy "real" windows writing. Geluk!

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu