I couldn't manage to create a pfx from PuttyGen or from openssl.
Following Derek Edson's advice, I went into mmc and could see that a
certificate was already created in my name.
In start menu, I opened under menu Visual Studio 2019 the shortcut
Developer PowerShell for VS 2019 and typed on th
I haven't tested yet for windows executables,
but recently for Android I had to sign an apk made with Lazarus for
Android Module Wizard,
you just need a free certificate created with Android Studio .
May be for Windows a certificate created with Puttygen is sufficient ?
_
It seems that in
https://wiki.freepascal.org/Translations_/_i18n_/_localizations_for_programs
in the paragraph "Quick i18n", it seems the link
(source )
http://www.redlinels.com/2014/01/10/most-widely-spoken-languages/
is no longer valid anymore.
_
I didn't tested but I imagine it could be done with something like this ?
type
TWindow_Class= class of TWindow;
begin
...
(myClass as TWindow_Class).CreateNewWindow( );
___
fpc-pascal maillist - fpc-pascal@lists.freepas
I see that Wikipedia is not very clear on this, you just find "x86"
mentioned, but for Pascal: "this Extended type is available on 16, 32
and 64-bit platforms, possibly with padding"
https://en.wikipedia.org/wiki/Extended_precision
___
fpc-pascal ma
Le 22/02/2024 à 15:08, Thomas Kurz via fpc-pascal a écrit :
But it's supported on Linux but not on Windows? Huh?
As far as I know Extended is not supported on Linux.___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.or
Le 09/02/2024 à 20:53, Jonas Maebe via fpc-pascal a écrit :
However, adding support for an option called -CFMax or similar should
be no problem.
It would be very nice to compile old code
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http
I've just made a small test with the old Borland Delphi 7.0 build 4453
from 2002 :
...
type
TForm1 = class(TForm)
m: TMemo;
procedure FormCreate(Sender: TObject);
end;
...
procedure TForm1.FormCreate(Sender: TObject);
var
GG: Extended;
S: String;
begin
GG := 8427+33/144
Le 08/01/2024 à 13:51, Peter B via fpc-pascal a écrit :
or if not, is there another way to
turn it on in the textmode IDE?
No idea. Its easy enough if you compile from the command line.
fpc -Os -XX hello.pas
If stripping is not on by default, also use -Xs
I guess that in the textmode IDE
Le 17/12/2023 à 17:47, Adriaan van Os via fpc-pascal a écrit :
Turbo Pascal (5.5) defines
label = digit-sequence .
Are you sure ?
I had a doubt and I had a look in some very old source code from 1990
made with tp 5.5, it seems you could have letters in labels.
Excerpt of the code:
PROC
Le 15/12/2023 à 10:39, Adriaan van Os via fpc-pascal a écrit :
I don't see a semicolon in the formal syntax.
May be included in the ' "DO" statement ' ?
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/ma
It sounds like "SpVoice := CreateOleObject('SAPI.SpVoice');" is failing
and then SpVoice is nil ?
May be try with an OleVariant instead of a simple Variant ? (i.e declare
var SpVoice: OleVariant; )
___
fpc-pascal maillist - fpc-pascal@lists.freepasc
Le 17/06/2023 à 20:07, Travis Siegel via fpc-pascal a écrit :
Is this a relatively new addition to fpc or something?
I 've just found it in my Delphi 7 code (and code very likely written
for Delphi 4), so I think it's there since at least 2000-2001 ...
May be it appeared with Delphi 1 ?
___
Le 12/06/2023 à 19:05, Steve Litt via fpc-pascal a écrit :
Busted! I used Pascal 1984-1993
So I guess you are not familiar too with the "Result" variable which
appeared with Delphi 1 in 1995 if I remember correctly.
nextt:= num;
can be written to as :
Result:= num;
https://www.freepascal.or
According to you other posts, I won't be surprised that you think in a
C/C++ way.
This doesn't change anything in your last example, but particularly :
nextt := num;
doesn't behave like in C :
return num;
In pascal I think the equivalent would be :
nextt := num; exit;
_
Oops, I hit "Send message" too quickly.
The only difference in the second code is:
- personrecord renamed to personclass and declared as "personclass = class"
- "newp:= personclass.Create;" added in function newperson
Of course for a clean code, you'll need to call something like
"FreeAndNil(
Hello, I have a hard time trying to understand what you want to test.
In your functions, you are using a record, not a class or a pointer to
record or an object.
The personrecord just behave in your parameters and return value as an
Integer or a String, and your fillchar doesn't write outside
Le 01/05/2023 à 17:00, Bo Berglund via fpc-pascal a écrit :
I have created a shellscript with the same command string
May be running directly your script in bash:
RunCommand('/bin/bash', ['your_script.sh' ], OutData)
___
fpc-pascal maillist - fpc-
I don't have an example at hand but I think you should run a bash
interpreter, something like :
RunCommand('/bin/bash', ['-c', ListCmd], OutData)
but I'm not 100% sure.
There is a good documentation at:
https://wiki.freepascal.org/Executing_External_Programs
May be you need to split your comma
... I wouldn't be surprised that James's program is a console one, not
using TForm nor any windows message loop to process WM_ messages, but I
may be wrong.
It can be more tricky in this case.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.o
May be you could get the source code of i2ctransfer from i2c-tools and
compare it with the code in i2c.pas ?
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
I couldn't verify the code but it should be relatively close to your
c++ example. Not sure of the width of int type, I supposed it's 16 bits
wide:
function CRC16( crc: Word; buf: PByte; len: Word; Poly:Word=$A001): Word;
var
pos: Word;
i: Word;
begin
for pos:= 0 to len-1
do
If your main program is a console program, it's likely that you'll need
to call CheckSynchronize( from unit Class) in your main program/main
thread from time to time in order to allow the execution of calls of
methods specified in Synchronize in your thread (which reads mqtt messages).
I'm not
Le 23/10/2022 à 23:59, Bo Berglund via fpc-pascal a écrit :
Might get stuck at readln(s) if no messages are sent, i.e. no carriage-return
coming along?
AFAIK readln is blocking, right?
I've made a test with mosquitto_pub, it seems there is a line ending at
the end of each message, so you will
Le 23/10/2022 à 22:50, Jean SUZINEAU via fpc-pascal a écrit :
This way you'll receive the output of mosquitto_sub on the standard
input of SomePascalProgram.
A very small example for SomePascalProgram for use with pipe, reading
on standard input and writing on standard output :
var
May be with a pipe | ?
Something like
mosquitto_sub -h 192.168.117.131 -F '@Y-@m-@d @H:@M:@S ; %t ; %p' -t '#' |
SomePascalProgram
This way you'll receive the output of mosquitto_sub on the standard
input of SomePascalProgram.
I've tested locally on an Apache log with
tail -f /var/log.a
Le 22/10/2022 à 23:37, Bo Berglund via fpc-pascal a écrit :
If I could get at each output that mosquitto_cli writes into a script or such
then I would be good to go.
Maybe with a redirection ( > ) to a file in bash ?
___
fpc-pascal maillist - fpc-pas
May be by escaping the spaces with ^ ?
Something like: MyFileName:= StringReplace(MyFileName, ' ', '^ ',
[rfReplaceAll]);
^ is the escape char for cmd.exe but may be it is active in this context
too ?
Le 20/09/2022 à 18:31, James Richters via fpc-pascal a écrit :
I just tried it that way
As Bart suggested, you can use too the for/in loop: for s in sl do
WriteLn( s);
For example:
var
sl: TStringList;
s: String;
begin
sl:= TStringList.Create;
try
sl.Add('1');
sl.Add('2');
for s in sl do WriteLn( s);
finally
FreeAndNil( sl)
Le 01/09/2022 à 07:50, Michael Van Canneyt via fpc-pascal a écrit :
The file seems corrupt. I tried several programs, none managed to open
it.
Indeed more than corrupt. For me, file is just empty (size 0 byte)
___
fpc-pascal maillist - fpc-pascal@li
Le 29/08/2022 à 01:41, James Richters via fpc-pascal a écrit :
If a special function is needed for some COM thing or weird Winapi thing, then
that function should be part of the unit that needs it, not modifying the
generic function intended to be used for general purpose applications output
s
An if you eventually need a read only UnionField :
TmByte= packed array[0..7] of Byte;
TDataExample2
=
record
internal
:
record
case integer
of
0: (mData: Int64);
1: (mByte: TmByte);
end;
property mByte : TmByte read internal.mByte;
May the solution to your problem should be just :
TDataExample
=
record
case integer
of
0: (mData: Int64);
1: (mByte: packed array[0..7] of Byte);
2: (UnionField: Int64);
end;
?
You aren't going to define a getter or setter method on your property,
just an "alia
For this particular error I think you should just follow the advice of
compiler in the error message :
Le 14/08/2022 à 11:49, Skybuck Flying via fpc-pascal a écrit :
// normal/standard property
property StandardField : integer read mStandardField write
mStandardField;
Wonderful !
Thank you very much for all your work and all the work of the FPC /
Lazarus team !
And Merry Christmas for all !
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
I don't know if it's related, but I experienced a similar problem a few
years ago.
It's a console dll written in Freepascal and compiled for Win64 and
Linux (Ubuntu). It uses several threads and uses CheckSynchronize to
make calls in the main thread.
The dll is loaded and used by a 4gl progr
I made a few tests on Ubuntu 64 bits (arch x86_64) with variations on a
small test program:
var
E2: Byte= 3;
E1: LongWord= 1;
E: QWord;
begin
E:= (1000*E1) shl E2;
writeln( 'E2', E2);
writeln( 'E1', E1);
writeln( 'E', E);
end.
In the assembly window, shl is computed
I've forgotten to add the link to "Snap!" manual:
https://snap.berkeley.edu/snap/help/SnapManual.pdf
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
May be something like "Snap!" ?
https://snap.berkeley.edu/snap/snap.html#present:Username=trev1315&ProjectName=plane%202&editMode&noRun
https://snap.berkeley.edu/project?user=trev1315&project=plane%202
On my own, I think starting with Lazarus and GUI apps would be far easier.
If you create a n
Ooops, may be I hit reply too fast.
It looks like when you write " TObjB = class(TObjA, IBBB)" you just
implement IAAA twice.
If you comment out IBBB
TImpB = class(TImpA{, IBBB})
public
procedure CallOfB;
//procedure IBBB.MethodB = CallOfB;
end;
then the "No matching implementati
Le 15/08/2021 à 00:43, Dmitry Boyarintsev via fpc-pascal a écrit :
Why is interface implementation not inherited, if explicit
implementation is used.
I guess this is because you can implement an interface through
delegation too:
https://www.freepascal.org/docs-html/ref/refse48.html
type
I
Le 21/06/2021 à 03:04, James Richters a écrit :
Var
...
DefaulSaveAsFileName: Ansistring;
SaveAsFileNameBuffer: array[0..Max_Path+1] of char;
...
Begin
DefaulSaveAsFileName := 'X:\Something with a really really really long
long long long file name to see if there is still a bug with
Ping uses ICMP protocol.
I don't have currently Indy installed on my machines, but I think you
can find pascal components for ICMP client and even ICMP server.
I think that this way you can do a single "ping", a single ICMP request.
It seems that Synapse has ping support too:
https://wiki.freep
I think you should have a look at this documentation on strings,
particularly for PChar :
https://www.freepascal.org/docs-html/ref/refsu9.html
Le 20/06/2021 à 02:09, James Richters a écrit :
DefaultFileName: AnsiString = '' ;
So Length(DefaultFileName) = 0
TFileName.nMaxFile:=Max_Path+1;
Thi
Le 19/06/2021 à 15:40, Bo Berglund via fpc-pascal a écrit :
function _2d( _i: Integer): String;
Strange name of a function, though, is that needed?
No, it's not needed, it's just my odd way of naming ... ;-) (the closer
to %.2d ).
___
fpc-pascal mai
It's curious, I'm not completely sure we are reasoning about the same
function and record.
You mention TFileName but for me in FPC 3.2.0:
- TFileName is declared as "TFileName= type string;" in sysutilh.inc.
- OPENFILENAMEA is declared as record in CommDlg.pp line 94
and TOPENFILENAMEA=OPEN
I haven't seen your reply.
Le 18/06/2021 à 23:50, James Richters via fpc-pascal a écrit :
So now I have:
TFileName.nMaxFile:= Length(DefaultFileName)+1;
TFileName.lpstrFile:=Pchar(DefaultFileName);
I need the +1 for the #0 at the end of the Pchar, and now it works
fine, and I can have strings
I'm not familiar with GetSaveFileNameA, but usually for the size of a
FileName buffer I use the constant MAX_PATH which is defined in unit
SysUtils.
MAX_PATH itself seems to be an alias from system unit where it is
defined accordingly to the operating system (260 on windows, 4096 on
Linux, 1
Ooops... little overflow bug
My computer has reached 33 days of uptime today and with
var
t, d, h, m, s: Integer;
you switch to the negative side ...
I got a display like : -8:-4:-52
Replacing with QWord solved the problem (I imagine DWord would just
allow for something like 66 days)
var
Le 18/06/2021 à 17:07, Bo Berglund via fpc-pascal a écrit :
I will need to check this in my connector class, the address to look for has to
be a config item in my application so it can be modified if need be without
rebuilding the app.
Have to figure out how to:
- Retrieve the output of the TProc
I've never used open vpn, may be the 10.117 is defined in your
configuration file ?
For the vpns I've used, the ip adressed were fixed.
( for route, you can type too something like "route print 10.117.*" )
___
fpc-pascal maillist - fpc-pascal@list
May be you can get some information with the "route" command .
If you run "route print" in cmd command prompt, you can get information
on the different networks available.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/route_ws2008
(I couldn't find the doc for
10 kb of Powerbasic ... you're cheating, it's pascal here ;-)
You can do this with just 1kb of PowerShell ...
( may be Pascal script could even be shorter ...)
File uptime.ps1 :
$MethodDefinition = @"
[DllImport("kernel32")] public extern static UInt64 GetTickCount64();
"@
$Kernel32 = Add-Type
My best score is 67 kb after strip -s with the code below ... ;-)
Of course it will not work on every version of Windows.
program uptime;
function GetTickCount64: QWord; stdcall; external 'kernel32.dll';
function _2d( _i: Integer): String;
begin
Str( _i, Result);
if Length(Result) <
I just add a small program to illustrate the type cast between signed
and unsigned:
var
si: ShortInt;
begin
si:= -127;
WriteLn( 'si ', si);
WriteLn( 'Byte(si) ', Byte(si));
si:= -1;
WriteLn( 'si ', si);
WriteLn( 'Byte(si) ', Byte(si));
end.
gives
$ ./project1
s
Le 16/06/2021 à 00:31, James Richters via fpc-pascal a écrit :
In order to change the value I want to change, I need to run my program as
administrator, is there a way to change to administrator with a request from
within the program?
I guess I could make just a small program that changes the
Le 16/06/2021 à 00:31, James Richters via fpc-pascal a écrit :
Thanks for the help, it's working fine using readinteger I guess as long as I
don't have any values large enough to need the most significant digit that
would work...
I guess that what was meaning Bart by hardcat is that you need
In Lazarus , in your source code, you can can "Ctrl + Click" on
Registry.ReadString and it will bring you to the declaration of
TRegistry.ReadString in unit Registry. There you will find there are
other methods like ReadInteger, ReadInt64, ReadBinaryData. I'm not sure
which one will best match
Note: if your string is UTF8 encoded, the last "character" can be
encoded, can span over 1 to 4 "Char", you need to know the length of
your character.
For example:
program Project1;
{$mode objfpc}{$H+}
uses
SysUtils, Classes;
var
s: array[0..30] of char;
p: PChar;
i: Integer;
begin
I think you could just manage the end of your string with a #0 char.
Just allocate enough space for the maximum size of your string plus the
terminal #0 char.
For example
program Project1;
{$mode objfpc}{$H+}
uses
SysUtils, Classes;
var
s: array[0..30] of char;
p: PChar;
begin
p:
Le 04/05/2021 à 01:55, James Richters via fpc-pascal a écrit :
I’ve been noticing odd behavior in Lazarus.. if I stop the program and
modify the form, then hit the green arrow… none of my for
modifications are shown.. it’s still using the old form.. but if I use
the pull down menus to build t
My code uses others units from this directories:
https://github.com/jsuzineau/pascal_o_r_mapping/tree/master/pascal_o_r_mapping/2_Units
https://github.com/jsuzineau/pascal_o_r_mapping/tree/master/pascal_o_r_mapping/3_Data
Particularly, Formate_Liste from
https://github.com/jsuzineau/pascal_o_r_ma
I do not guarantee anything, I didn't use this recently, but I have a
function for sending mail with attachments using Synapse.
It's the function MailTo_SMTP in this unit :
https://github.com/jsuzineau/pascal_o_r_mapping/blob/master/pascal_o_r_mapping/3_Data/uMailTo.pas
(my code is under LGPL, y
Le 03/05/2021 à 13:55, James Richters via fpc-pascal a écrit :
>Defining it in public in TText_to_PDF is a good idea.
I tried putting it under the destructor in public… above the private
variables, but it wouldn’t compile thereI thought it would have to be
above all the functions and procedure
Le 02/05/2021 à 23:42, James Richters via fpc-pascal a écrit :
But I’m thinking I didn’t really define the variable the way it would
normally be done with Lazarus.
Just for notice: classes and objects are not particular to Lazarus, it's
plain Object Pascal, understood by Freepascal and Delphi wh
Le 01/05/2021 à 15:27, James Richters via fpc-pascal a écrit :
Any ideas how to save and restore the column widths for
VirtualStrinTrees in the ini file?
Done with the events and methods of TIniPropStorage.
___
fpc-pascal maillist - fpc-pascal@lists.
Sorry, I didn' had time this week to have a look to your last additions.
Le 01/05/2021 à 15:27, James Richters via fpc-pascal a écrit :
Any ideas how to save and restore the column widths for
VirtualStrinTrees in the ini file?
I imagine it can be done through the events of the IniProperty Stor
Le 25/04/2021 à 21:30, James Richters via fpc-pascal a écrit :
>I added LoadFromFile in this event.
That was the first thing I tried, but the problem is, this happens before
anything is put on the screen.. so when I run the program with an Ini file with
4000 entries in it, there is a
Le 25/04/2021 à 15:24, James Richters via fpc-pascal a écrit :
RE: [fpc-pascal] Directory Tree
I fixed the time totals to show days correctly with this:
I didn't use your pull request because I don't know yet how to handle it.
I have delete some files which differed only by case. After commit
Le 25/04/2021 à 02:54, James Richters via fpc-pascal a écrit :
RE: [fpc-pascal] Directory Tree
I’ve been trying make “Load from file”happen automatically when the
program starts.. I would like it to happen after configuration.ini
restores the file name and also after the form is on the screen
Le 23/04/2021 à 19:56, James Richters via fpc-pascal a écrit :
RE: [fpc-pascal] Directory Tree
Get Checked or Selected works great, but if I push it twice, the
second time I get:
Unable to open file
C:\Users\James\AppData\Local\Temp\FiC152.odt
But I did make sure to close word and the PDF f
Le 23/04/2021 à 11:08, James Richters via fpc-pascal a écrit :
RE: [fpc-pascal] Directory Tree
Now if I type new text in the ODT document, it’s Consolas, but the
actual text in the document is still Liberation Serif… and it doesn’t
align, if I select all the text and change it to Consolas it’s
Le 22/04/2021 à 22:17, James Richters via fpc-pascal a écrit :
RE: [fpc-pascal] Directory Tree
My system could not find DejaVuSans,
You can find it in
C:\lazarus\fpc\3.2.0\source\packages\fcl-report\demos\fonts.
May be you don't need to install the font, just add on the line below
where you
Le 22/04/2021 à 23:17, James Richters via fpc-pascal a écrit :
For some reason the ODT file wants to know if I want to translate it
from French, and while the font is “Courier New” for anything I would
type into the document, the font of the text itself is “Liberation Serif”
If I change the
Another way of seeing is to generate and odt file with the generated text.
You get a slightly better rendering because I could define Courier New
as default font in the new template: FileVirtualTree_txt_to_odt.odt
From the OpenOffice "File" menu, you can generate a pdf file.
There is a way to
Le 18/04/2021 à 17:22, James Richters via fpc-pascal a écrit :
RE: [fpc-pascal] Directory Tree
I figured out how to make a pdf file, but I don’t know how to
implement it… if we can just have a button to print result.txt… then I
could just change the printer to Microsoft Print to PDF which is
i
Le 18/04/2021 à 16:10, James Richters via fpc-pascal a écrit :
RE: [fpc-pascal] Directory Tree I getuFileVirtualTree.pas(533,9)
Error: identifier idents no member "DefaultEncoding"
It seems, using svn blame, that DefaultEncoding has been added in
FreePascal source trunk on the svn server on June
In Unicode/UTF8 "char" can be represented by several bytes so my code
won't work.
It seems you use page code 850 (here in France we are in 1252 which
doesn't have the box chars).
In unit uFileVirtualTree line 469, I have added type String850= type
String(850);
declared the local variable
Le 15/04/2021 à 20:16, James Richters via fpc-pascal a écrit :
It doesn't have to be a PDF, it could be an image file, or even a text
file...maybe I can just make a text file of the output and use box
characters to draw the tree. It seems like I should be able to get the
branches of the treedat
Le 15/04/2021 à 15:31, James Richters via fpc-pascal a écrit :
How did you make the TVirtualStringTree open the first level? I've been
looking to see how you did it but I don't see how that was done.
unit uFileVirtualTree, line 360, method
ThVirtualStringTree.vst_expand_first_level;
I would
Le 14/04/2021 à 13:06, James Richters via fpc-pascal a écrit :
I still can’t get off the Master branch on my windows machine. I
deleted everything, re-forked it, re-cloned it,
I finally found on my linux machine a 'test_gICAPI\jsLignes.Exclus.txt'
file right in tools directory, and remo
Le 13/04/2021 à 13:50, James Richters via fpc-pascal a écrit :
I tried to make a fork of your repository but I could not change off the master
branch,, I always get an error: Checkout Failed Cannot checkout to invalid
path 'tools/text_glCAPI\jsLignes.Exclus.txt' I suspect the / in the path i
I have updated the VirtualTreeView example with sub-totals of time.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
TStringList works pretty much like an inifile section.
The index corresponds to the line number in you text block.
The Names property corresponds to the part of the line before the '=' char.
The ValueFromIndex property corresponds to the part of the line after
the '=' char.
So if you line i conta
Indeed, I think it's difficult (if possible) to change the behaviour of
the multiselection this way.
The TTreeview.MultiSelectStyle property allows you to change from
CtrL+Click to Shift+Click.
https://lazarus-ccr.sourceforge.io/docs/lcl/comctrls/tmultiselectstyle.html
To make the multi sele
(I re-send my mail with different sender, it seem the first one has been
blocked by orange)
I made a short example based on TTreeView with your data at :
https://github.com/jsuzineau/pascal_o_r_mapping/tree/TjsDataContexte/tools/FileTree
You just need to download all the files , open project F
If you just select files, as Bart stated in another message, I think
TShellTreeView will be more adequate and easier than TTreeView (actually
TShellTreeView is a file tree specific descendent TTreeView).
In TTreeView (and TShellTreeView) you can enable multiselection by
adding tvoAllowMultiSel
As far as I understand, you are searching for a general tree component
like TTreeView in Lazarus, but for FreeVision, running in text mode in
console ?
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/m
Le 04/04/2021 à 02:41, James Richters a écrit :
That looks almost perfect.. can I suppress the trailing zeros with the
format command without losing the alignment?
As far as I know, no ...
Not with just the RTL.
Anyway I have personal code for this, you can extract and customize it
to yours
Normally something like this should do the trick (here 3 decimals and 7
characters for total width):
program Format_Example;
uses
sysutils;
procedure F( _d: double);
var
S: String;
begin
S:= Format('%7.3f',[_d]);
WriteLn( S);
end;
begin
F(0.5);
F(2.53);
F(12.5);
Le 01/01/2021 à 00:48, James Richters via fpc-pascal a écrit :
I’m not too familiar with PChars, but is there a way to set it to zero
length?
I set it to #0 and it works ok with the #0 in there with Notepadd++
but I think it’s technically not correct.
For me, it's correct. C strings are ju
Le 28/12/2020 à 13:16, Bo Berglund via fpc-pascal a écrit :
Synchronize(CallEvent); //Supply received data in FBuffer to
caller
You are using TThread.Synchronize.
In a console app, it's likely that somewhere else in your main thread
you'll need to call regularly Classes.CheckSynchron
May be using TBlockSerial from unit synaser from Ararat Synapse ?
( doc: http://synapse.ararat.cz/doc/help/synaser.TBlockSerial.html ,
download: http://synapse.ararat.cz/doku.php/download ).
Given a variable (SynSer: TBlockSerial;), you can test if data is
available with SynSer.CanReadEx(0) an
Amazing !
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Le 20/12/2020 à 16:02, James Richters via fpc-pascal a écrit :
If I need a bunch of case statements, it's atcually worse than if I just have
separate procedures.
No, in fact the case statement is written only once, in the
implementation of TAxisRecord, and in procedure
Move_It(Axis_Letter:Ch
I know you don't like objects, but maybe something like :
unit uAxisRecord;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
{ TAxisRecord }
TAxisRecord
=
object
X,Y,Z,A,B,C: Double;
function Value_from_Letter( _A
Le 09/10/2020 à 10:15, Santiago A. via fpc-pascal a écrit :
Just nitpicking.
Shouldn't "try" be after the "reset" and after the "rewrite"?
Why don't you allow to write an empty string?
Yes, you're right, the Reset/Rewrite should be after the try.
I admit this code is not general, just tailored
In my own code I use BlockRead/BlockWrite, but I'm wondering if
I've not seen this somewhere in RTL.
https://github.com/jsuzineau/pascal_o_r_mapping/blob/TjsDataContexte/pascal_o_r_mapping/02_Units/uuStrings.pas
function String_from_File( _FileName: String): String;
Personnally I go even further ;-)
if something
then
begin
some multi-line code here
end
else
begin
some multi-line code here
end;
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/m
Another way is to declare TMyRec as class instead of record.
In this case, you don't need the dereference operator ^ .
No need of new and dispose, just Create and Free, as for TMyRecList.
I don't know if there is a better performance when you use a record,
but as far as I know, record/object/n
1 - 100 of 148 matches
Mail list logo