Recent

Author Topic: Creating a file type....  (Read 3916 times)

captian jaster

  • Guest
Creating a file type....
« on: September 04, 2010, 10:37:58 pm »
I want to create my own file type(So say a document type..)
I under stand that files work off of headers but is it said in a packed record(Mind you I have only used packed arrays before)
Code: Pascal  [Select][+][-]
  1. MyDoc = Packed Record
  2.  Something:Pointer;
  3.  Body:String;
  4.  B:Boolean;
  5. End;
  6.  
Or is just done has a record  %)
Not sure what im doing now  :-[

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1930
Re: Creating a file type....
« Reply #1 on: September 05, 2010, 01:22:08 am »
Use a TFileStream:

http://lazarus-ccr.sourceforge.net/docs/rtl/classes/tfilestream.html
http://lazarus-ccr.sourceforge.net/docs/rtl/classes/tstream.html

and write your data using:
FS.WriteBufffer(Buffer,Count);
or
FS.WriteAnsiString(S);
or
FS.WriteByte(B);
etc..

captian jaster

  • Guest
Re: Creating a file type....
« Reply #2 on: September 05, 2010, 01:55:21 am »
Cool, Ill try that

 

TinyPortal © 2005-2018