Post by metro on May 16, 2023 3:53:36 GMT -5
I'm obviously getting rusty!
struggling to understand why a variable will not work(highlighted below)
I could just write to a file instead and load into a listbox that way.
curious to know what I am doing wrong.
the issue is with another project I am working
thanks for the help
'Form created with the help of Freeform 3 v07-15-08
'Generated on Nov 30, 2018 at 16:20:26
global NumLines , z
'nomainwin
LotsOflines$(1)="A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core. "
LotsOflines$(2)="Segfaults are caused by a program trying to read or write an illegal memory location. Program memory is divided into different segments: a text segment for program instructions, "
LotsOflines$(3)="a data segment for variables and arrays defined at compile time, a stack segment for temporary (or automatic) variables defined in subroutines and functions, "
LotsOflines$(4)="and a heap segment for variables allocated during runtime by functions, such as malloc (in C) and allocate (in Fortran). For more, see What are program segments,"
LotsOflines$(5)=" and which segments are different types of variables stored in? A segfault occurs when a reference to a variable falls outside the segment where that variable resides, "
LotsOflines$(6)="or when a write is attempted to a location that is in a read-only segment. In practice, segfaults are almost always due to trying to read or write a non-existent array element,"
LotsOflines$(7)="not properly defining a pointer before using it, or (in C programs) accidentally using a variable's value as an address (see the scanf example below):"
[setup.main.Window]
'-----Begin code for #main
' nomainwin
WindowWidth = 550
WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
TexteditorColor$ = "white"
texteditor #main.textedit3, 5, 5, 530, 100
button #main.button1,"TOP",[button1Click], UL, 320, 150, 38, 25
button #main.button2,"BOTTOM",[button2Click], UL,370, 150, 68, 25
'-----End GUI objects code
'-----Begin menu code
menu #main, "Edit" ' <-- Texteditor menu.
'-----End menu code
open "untitled" for window as #main
print #main, "font ms_sans_serif 10"
print #main, "trapclose [quit.main]"
[main.inputLoop] 'wait here for input event
for a = 1 to 7
#main.textedit3, LotsOflines$(a)
next
'----------------------------------------------------
' WHY DOESN'T A VARIABLE WORK z fails as does print
'----------------------------------------------------
[GET.LINES.BACK]
DIM remittance$(100000)
#main.textedit3 ,"!lines LineCount" ;
print LineCount
for z = 1 to LineCount
print #main.textedit3, "!line z recs$"
remittance$(z) = recs$
print recs$
next
'#main.slist,"reload"
'*****************************************************
wait
[button1Click] 'Perform action for the button named 'button1'
#main.textedit3, "!origin 1 1" ;
wait
[button2Click] 'Perform action for the button named 'button2'
call countlines
#main.textedit3 , "!origin "; " 1 "; NumLines/2 ;
' print NumLines
wait
[quit.main] 'End the program
close #main
end
sub countlines
'print #main.textedit3, "!origin? columnVar rowVar " ;
print #main.textedit3, "!lines NumLines" ;
end sub