Search found 62 matches

by nedman47
Feb 04, 2007 14:11
Forum: DOS
Topic: redirected output has extra cr
Replies: 0
Views: 2001

redirected output has extra cr

write one line program

print "x"

call it z.bas
compile it with freebasic
run it like this z > z.txt

if you look at z.txt with a binary editor, you see x cr cr lf
if you compile it with qb45 you see x cr lf

freebasic seems to be adding an extra cr during redirection
by nedman47
Jan 25, 2007 14:03
Forum: DOS
Topic: regex lib missing ?
Replies: 1
Views: 2484

regex lib missing ?

i tried to compile the example program regex_replace.bas with the dos version of freebasic 0.16 and got a loader error ... "cannot find -ltre"

what am i doing wrong?
by nedman47
Jan 17, 2007 17:06
Forum: DOS
Topic: dir attributes
Replies: 12
Views: 6110

dir attributes

Code: Select all

dim as string t
t = dir("*",16)
do
   if t = "" then exit do
   print t
   t = dir()
loop
This code returns everything, not just directory names.

There appears to be a discrepancy in the docs for DIR. One place it says the directory attribute is 0x8 and another place 0x10.
by nedman47
Dec 31, 2006 17:44
Forum: DOS
Topic: general protection fault
Replies: 12
Views: 5810

I was able to use regular strings by allocating len(text) + 12 bytes for the descriptor which is the value of sizeof(string).
by nedman47
Dec 23, 2006 15:20
Forum: General
Topic: life after piping to stdin
Replies: 8
Views: 1649

yes, that is what i thought. once you close piped stdin, it does not seem to get reopened for keyboard input.

i was unsure if it was a compiler issue or a "feature" of dos pipes.
by nedman47
Dec 23, 2006 14:48
Forum: General
Topic: life after piping to stdin
Replies: 8
Views: 1649

the program would be run like this

dir | example.exe

the example code i posted earlier processes chars from dir via the pipe then hangs at inkey. i have to close the dos box with the X button.
by nedman47
Dec 23, 2006 14:33
Forum: General
Topic: life after piping to stdin
Replies: 8
Views: 1649

i'm writing an editor which first reads a file from disk, then receives commands from the keyboard. i thought it would be handy to be able to read the file from stdin instead of disk. this works, but the console remains pointed at the piped input so i am unable to receive editor commands from the ke...
by nedman47
Dec 23, 2006 13:41
Forum: General
Topic: life after piping to stdin
Replies: 8
Views: 1649

life after piping to stdin

open cons for input as #1
do while not eof(1)
line input #1, x
print x
loop
close #1

x = inkey

x never sees any chars in the last line.

is there any cure for this?
by nedman47
Dec 22, 2006 22:03
Forum: General
Topic: EOF in stdin?
Replies: 15
Views: 4800

reading piped input

open cons for input as #1
do while not eof(1)
line input #1, x
print x
loop
close #1

x = inkey

x never sees any chars in the last line.

is there any cure for this?
by nedman47
Dec 21, 2006 16:03
Forum: General
Topic: profile ... where is gmon.out
Replies: 4
Views: 1547

i might have figured it out ... i was exiting with SYSTEM. i changed that to END, compiled with -profile, ran the program, and got a file called PROFILE.TXT.
by nedman47
Dec 21, 2006 15:55
Forum: General
Topic: profile ... where is gmon.out
Replies: 4
Views: 1547

when i exit the program, there is no gmon.out anywhere on the disk
by nedman47
Dec 21, 2006 15:22
Forum: General
Topic: profile ... where is gmon.out
Replies: 4
Views: 1547

profile ... where is gmon.out

I compiled my program with the -profile switch. The exe gets bigger and slower, but I cannot find gmon.out!
by nedman47
Dec 11, 2006 0:49
Forum: DOS
Topic: poking screen of dos box
Replies: 3
Views: 2687

poking screen of dos box

i am translating a program from qb45 to freebasic that uses poke to change screen colors thusly

def seg = &hb800
poke 1,&h2e

i expected to be able to translate that into

poke &hb8001,&h2e

but it does not work.

i am working in a dos box (console) of windows xp.
by nedman47
Dec 08, 2006 15:46
Forum: DOS
Topic: trapping control c and control break
Replies: 6
Views: 6395

trapping control c and control break

i'm writing a program that should not allow control-c or control-break but it might be handy to trap rather than suppress them. is there any way to do that without 'on error' ?
by nedman47
Dec 05, 2006 20:25
Forum: DOS
Topic: general protection fault
Replies: 12
Views: 5810

general protection fault

ok i figured out how to operate the debugger the program does not fail every time when it does fail, it is at a line like this ... type cell as string ptr value as cell ptr prevcell as cell ptr nextcell end type ... btm = callocate(len(cell)) btm->value = callocate(3) *btm->value= "btm"