Quoting Kris Leech <[EMAIL PROTECTED]>:
is create something for FPC/Lazarus which is similar to a SFS (Single
File System) so all files are stored as a byte stream in a single file.
Micro$oft call this "Structured Access" instead of "Virtual File System".
Other people use the words "Virtual File System" for other similar stuff,
but the one you are using is OK.
then how to use that byte stream with other functions etc. that do not
take TStream as input.
OK. Standard file operations (Reset, Rewrite, Close) are easier to learn than
stream classes.
BUT, doesn't allow to extend
or customize file access, so, forget about "File Of <MyType>".
"Streams" are better to customize for custom situations, like Virtual
FileSystems.
A third option, would be to create your own "File" type
record and create its own functions. I DID THIS.
Any ideas you have or have previously implimented would be great to hear.
OK, I wanted to do the same thing. Any O.S. has its own standard libraries
to access its "Standard" File System. In windowze, it's called O.S - A.P.I.
(Operating System - Aplication Program Interface)
To get to the point, I DID THAT, a set of libraries/functions,
for a custom Virtual File System.
Let me tell you how I started:
1. Create a custom "System" unit:
------------------
unit MyVFS;
interface
...
implementation
...
end.
------------------
2. Add the standard functions/procedures,
and make the wrappers first, and the internal code, later:
------------------
function FileExists(const Path: string): Boolean;
begin
Result := false;
// to-do...
end;
function DirExists(const Path: string): Boolean;
begin
Result := false;
// to-do...
end;
procedure CreateDir(const Path: string);
begin
// to-do...
end;
procedure DeleteDir(const Path: string);
begin
// to-do...
end;
procedure DeleteFile(const Path: string);
begin
// to-do...
end;
procedure RenameDir(const Source, Dest: string);
begin
// to-do...
end;
procedure RenameFile(const Source, Dest: string);
begin
// to-do...
end;
procedure CopyDir(const Path: string);
begin
// to-do...
end;
procedure CopyFile(const Path: string);
begin
// to-do...
end;
------------------
There is more things to do.
For example, how are you going to
write a path ?
MS-DOS/Windowze style:
"c:\mydocs\myhomework.txt"
Unix style:
"/public/mydocs/myhomework.text"
Do you want to continue
with the code ideas I sending you ?
Do you want to try another stuff by your self ?
driver for Win32 and Linux to allow proper OS access to the SFS... Then
they would work like native files.
I think the drive aproach is VERY difficult.
Anyway, A.P.I. libraries encapsulate/hide drivers...
Just my 2 cents...
maramirez
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives