Author Topic: Need a sample prog to write and then read from a random file  (Read 1197 times)

0 Members and 1 Guest are viewing this topic.

chrisc

  • Guest
Need a sample prog to write and then read from a random file
« on: March 12, 2018, 12:30:38 PM »
Hello all

in PB, we can create random file and then able to retrieve data from it by pointing to an index

i need a sample or example O2 program to show me how to create a random file, write some data with an index
 and then able to read data from it using an index.   Where can i get this program ?

thanxx for any help

Charles Pegge

  • Guest

chrisc

  • Guest
Re: Need a sample prog to write and then read from a random file
« Reply #2 on: March 13, 2018, 07:12:33 AM »
Thanxx Charles,  i will check it out

chrisc

  • Guest
Re: Need a sample prog to write and then read from a random file
« Reply #3 on: March 13, 2018, 10:16:17 AM »
Thanxx a lot,  Charles
this is a simple and very good example

but need some explanation for
wchar s[64]

does this means that we define it (the fourth term in the data type) as a 64 characters string?

Charles Pegge

  • Guest
Re: Need a sample prog to write and then read from a random file
« Reply #4 on: March 13, 2018, 10:59:58 AM »
Code: [Select]
'EXAMPLE RECORD
type xyzlabel
  float x,y,z
  wchar s[64]
end type

This is a flat record of 140 bytes

12 bytes for the 3 floats, and 128 bytes for the 64 wide (unicode) characters

I thought a bit of unicode would be trendy :)

chrisc

  • Guest
Re: Need a sample prog to write and then read from a random file
« Reply #5 on: March 13, 2018, 02:03:13 PM »
Yup we need unicode strings