Re: Newbie problem
- Posted by "Hayden McKay" <hmck1 at dodo.com.au> Dec 31, 2003
- 457 views
Place this at the top of all 'while & for' loops (after any delcared values) doEvents(0) This will keep everything active while loops are running. This also prevents the app to "not responding" incase of a very long loop. You will need to disable any buttons you dont want the user to press while your loops are running using. setEnable(PushButton1,False) -- disables push button 1 setEnable(PushButton1,True) -- enables push button 1 ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: <EUforum at topica.com> Sent: Wednesday, December 31, 2003 1:42 AM Subject: Re: Newbie problem > > > ----- Original Message ----- > From: "Allen Robnett" <alrobnett at alumni.princeton.edu> > To: <EUforum at topica.com> > Sent: Tuesday, December 30, 2003 2:16 PM > Subject: Newbie problem > > > > Sorry to be so uninformed. I want to create a file of 65536 fixed length > > records, 8 bytes each. These will be selectively displayed at various > > locations on the screen, modified and rewritten. From what I have read, > > I thought the following would accomplish my goal. (The initial contents > > of the file are simply the number of the corresponding record.) > > > > node_array = {} > > for i=1 to 65536 do > > node_array = append(node_array, sprintf("%08d",i)) > > end for > > fn = open("nodes.dat", "wb") > > > > <snip> > > This inserts commas and sequence brackets into the string. That is not > > what I wanted or intended, but would be acceptable if I could get it to > > print out 8 characters at a time. I thought the following should display > > the third word, but instead, it displays only one character. > > > > fp=seek(fn,0) > > s = get(fn) > > node_array = s[2] > > trace(2) > > printf(1,"%8s",node_array[3]) > > > > What am I missing? > > > > Try using 'getc()' to read in a byte at a time. To read in a whole record, just read in 8 bytes. > > s = repeat(0, 8) > s[1] = getc(fn) > s[2] = getc(fn) > s[3] = getc(fn) > s[4] = getc(fn) > s[5] = getc(fn) > s[6] = getc(fn) > s[7] = getc(fn) > s[8] = getc(fn) > > To get to a specific record if you know its record number do this... > > if seek( fn, (recno-1) * 8) then > -- read in the record. > else > -- error > end if > > > -- > Derek > > > > TOPICA - Start your own email discussion group. FREE! > > > -- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/03 > --- --