Recent Posts

Pages: [1] 2 3 ... 10
There are fewer and fewer users, and trolls are just as rare.
This change is on the dev branch. It will be in the next release, hopefully coming soon.
Yes, you are most probably right dsiders.... sometimes I can't help myself. Call me stupid and/or hardheaded  :)
Don't feed the troll.
I still find it peculiar that the bad impression that was provided by the distribution of your choice has (according to the statements you made) something to do with the efforts and/or responsibility of the FPC and Lazarus developers.

For convenience you skipped your own choices (choosing a older LTS/stable distribution) and the responsibility of the distribution of your choice (and its maintainers).

Windows and Linux are not the only two platforms that are supported by FPC/Lazarus let alone the many different distributions that exist of/for only these two platforms alone (that you conveniently left out all other Linux distributions that you are not familiar with or in your opinion are uncommon is besides the point).

The team provides different packaging methods that are used in almost all *nix distributions and in case there is none for you platform than you can always fall back to the basic install package. And all these files that are provided are only for convenience as you can build things from source.

But, I wish you good luck in trying to convince ubuntu maintainers into updating their Lazarus packages of the distribution of your choice. You will most probably receive the  same answer or you already got that answer there and tried to make another attempt here. I can only guess.

An analogy of your request is like a 5 lane highway in a complete traffic jam and wanting to pass all and everything using the emergency lane because in your opinion that is the right thing to do and at the same time want someone else to take the driver seat... never mind the seat belts  :D
General / Re: What is the easiest way to flush the buffer to disk.
« Last post by TRon on Today at 05:51:24 am »
The first few lines work as expected.  However, I get errors about ...'arg no. 1 has to match exactly: Got "ansistring" expected "Text"'....

Check whether a particular file exists in the file system.

Code: [Select]
function FileExists(const FileName: UnicodeString; FollowLink: Boolean = True):Boolean;

Code: [Select]
If FileExists(dbName)=False Then FileCreate(dbName);           // -- create it

Create a new file and return a handle to it.

Code: [Select]
function FileCreate(const FileName: UnicodeString):THandle;

Code: [Select]
  If FileExists(dbName)=True Then  FileOpen(dbName,fmOpenRead);  // -- open for read

Open an existing file and return a file handle

Code: [Select]
function FileOpen(const FileName: unicodestring; Mode: Integer):THandle;

Code: [Select]
  If FileExists(dbName)=True Then  Flush(dbName)                 // -- flush buffer to disk)

Code: [Select]
function FileFlush(Handle: THandle):Boolean;

note the handle parameter.

Code: [Select]
  If FileExists(dbName)=True Then  FileClose(dbName);            // -- close it

Close a file handle.

Code: [Select]
procedure FileClose(Handle: THandle);

But ofc. it is always easier to ask on the forums than it is to read the documentation... so right back at you  ;D

Code: Pascal  [Select][+][-]
  1. var
  2.   dbName: string;
  3.   fh : THandle;
  4. begin
  5.   dbName := IncludeTrailingPathDelimiter(GetCurrentDir()) + 'test.db';
  6.   if not FileExists(dbName) then
  7.   begin
  8.     fh := FileCreate(dbName);           // -- create it
  9.     // do something with the file such as writing data to it
  10.     FileClose(fh);
  11.   end;
  13.   if FileExists(dbName) then
  14.   begin
  15.     fh := FileOpen(dbName, fmOpenRead);  // -- open for read
  16.     // make sure the filehandle is valid
  17.     if fh <> feInvalidHandle then
  18.     begin
  19.       // do something with the file such as writing data to it
  20.       if FileFlush(fh)         // -- flush buffer to disk)
  21.         then writeln('data was flushed');
  23.       FileClose(fh);            // -- close it
  24.     end;
  25.   end;
  26. end.

Flushing usually only makes sense when using a file in read/write mode and actually read and write to it simultaneously.
Thank you circular I am happy to hear that you are happy with my videos. :)

I see that HSL script was fixed here

but new downloads do not use fixed file why ?.

Have a nice day. :)
General / Re: What is the easiest way to flush the buffer to disk.
« Last post by Red_prig on Today at 04:07:04 am »
If you are using a database you should use the interface of the database you want to use (I don't understand which one you mean).
 FileCreate/FileOpen/Flush/FileClose is a more general file interface that you are trying to use in a strange way (you clearly haven't read the documentation)
General / What is the easiest way to flush the buffer to disk.
« Last post by CaptBenB on Today at 03:56:53 am »
The first few lines work as expected.  However, I get errors about ...'arg no. 1 has to match exactly: Got "ansistring" expected "Text"'....
when attempting to Flush the dbName, I get an error on close as well.

The goal is to create an empty file when one does not exist and skip the creation if it does exist without errors of course.

The issue is that when the file is not 'Flushed' to disk, the subsequent SQL statements fail b/c the file does not exist on disk yet.  Once the file exists, all the sql statements work.

I've read some on the pointers, and PChar, and single character files, ... it's kind of jumble in my head.  Any help is appreciated.

Code: Pascal  [Select][+][-]
  2.   // -------------------------------------------------------------
  3.   // -- create the db if it does not exist
  4.   // -------------------------------------------------------------
  5.   dbName := IncludeTrailingPathDelimiter(GetCurrentDir()) + 'test.db';
  6.   If FileExists(dbName)=False Then FileCreate(dbName);           // -- create it
  7.   If FileExists(dbName)=True Then  FileOpen(dbName,fmOpenRead);  // -- open for read
  8.   If FileExists(dbName)=True Then  Flush(dbName)                 // -- flush buffer to disk)
  9.   If FileExists(dbName)=True Then  FileClose(dbName);            // -- close it
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018