Solved

saving text and data arrays to a disk file

Posted on 1998-10-21
4
145 Views
Last Modified: 2010-04-30
ok what is the cleanest and quickest way to save the contents of an three dimensional variant array to disk (preferable as a binary file not ASCII)
0
Comment
Question by:spg01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Expert Comment

by:zivf
ID: 1440951
No clean way but to create a special function for it?
Don't you know the data type of the array items?
In MFC you have serialization, but it is internally managed, and to say gently, not the easiest thing in the world to design and program...
0
 
LVL 2

Expert Comment

by:gikam
ID: 1440952
declare the variabile say xxx as 3d array type
use PUT #1,xxx
0
 
LVL 3

Accepted Solution

by:
fguerreiro_inix earned 50 total points
ID: 1440953
Instead of an tridimentional array, make an array of a userdefined type.

This example uses the Put statement to write data to a file. Five records of the user-defined type Record are written to the file.

Type Record      ' Define user-defined type.
      ID As Integer
      Name As String * 20
End Type

Dim MyRecord As Record, RecordNumber      ' Declare variables.
' Open file for random access.

Open "TESTFILE" For Random As #1 Len = Len(MyRecord)

For RecordNumber = 1 To 5      ' Loop 5 times.
    MyRecord.ID = RecordNumber      ' Define ID.
    MyRecord.Name = "My Name" & RecordNumber   ' Create a string.
    Put #1, RecordNumber, MyRecord      ' Write record to file.
Next RecordNumber

Close #1      ' Close file.

if you want to encrip your data, use Xor operator

Hope this helps
Regards
0
 
LVL 1

Expert Comment

by:lawnranger
ID: 1440954
How about back to (Visual) Basics?
I respectfully submit the following...

Dim a(1 To 10, 1 To 10) As Integer
Dim b(1 To 10, 1 To 10) As Integer
Dim i As Integer, j As Integer
For i = 1 To 10
  For j = 1 To 10
    a(i, j) = i * j
  Next j
Next i
Open "C:\Test.bin" For Binary As #1
Put #1, , a
Close #1
Open "C:\Test.bin" For Binary As #2
Get #2, , b

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question