PSN-L Email List Message

Subject: Basic Programming Help desired?
From: "Geoff" gmvoeth@...........
Date: Sun, 4 May 2008 21:17:52 -0700


Hello PSN Peoples;

I am trying to make a routine
that will save an array of single
bytes to a raw data file on the hard
drive and do this as quickly as possible.
Below you will see a routine that works
very well for me but its too darn slow.
When the program enters this routine
it will linger for many seconds
appearently converting the data array
into the strings before eventually
actually saving the data into the file.
I do not understand the terrible long
time this routine seems to take.

Can someone with more experience
please tell me what Im doing wrong
that takes so long ( literally several
seconds for only 32770 bytes total) to complete.
I would like a speed that rivals a BSAVE command.

This is how i save my seismic data
to a raw 8 bit file
after recording it to the array
in RAM.

Thanks for any help.
feel free ro email me direct.

Regards;
geoff

**********************************
POWERBASIC FOR DOS COMPILER SOURCE CODE

$LIB COM        ON
$LIB FULLFLOAT  ON
$LIB VGA        ON
$ERROR BOUNDS   ON
$ERROR NUMERIC  ON
$ERROR OVERFLOW ON
$ERROR STACK    ON
$CPU 80386
$COM    1024
$STRING 32
$STACK  2048
$SOUND  256
$DYNAMIC
$COMPILE EXE "TEST.EXE"
$FLOAT NPX
$OPTIMIZE SPEED
$EVENT
$OPTION CNTLBREAK ON

' CREATE AN ARRAY FOR RAW DATA
DIM VIRTUAL DATA_1?(0:32780)
' Fill the array with ascii text characters
' So resulting file can be easily examined
' with a hex editor normally this is the recording
FOR a = 0 to 32780 : DATA_1?(a) = ( 65 + a MOD 58 ) : NEXT a
' Form a file path and name
FILE1$ = "c:\data\test.dat"
' screen not necessary just habit
SCREEN 11
' below is the routine in question
tmpz1$ = ""
FOR ka = 0 to 32255
tmpz1$ = tmpz1$ + chr$(DATA_1?(ka))
NEXT ka
tmpz2$ = ""
FOR ka = 32256 to 32769
tmpz2$ = tmpz2$ + chr$(DATA_1?(ka))
NEXT ka
OPEN FILE1$ FOR BINARY AS #1
SEEK #1,0 : PUT$ #1,tmpz1$
SEEK #1,32256 : PUT$ #1,tmpz2$
CLOSE #1
tmpz1$ = "" : tmpz2$ = ""
' task completed return to system
SYSTEM


*****************************

__________________________________________________________

Public Seismic Network Mailing List (PSN-L)


[ Top ] [ Back ] [ Home Page ]