2,551 questions
0
votes
1
answer
65
views
Which scope does the {$I-} directive have in Pascal?
I disable I/O checking inside a procedure:
procedure RewriteText(
FileName: string;
var TextFile: text;
var ErrMsg: string
);
begin
{$I-}
assign(TextFile, FileName);
rewrite(...
-1
votes
1
answer
96
views
Can't import DLL into Inno Setup ver 6.5.1 [closed]
Hi I'm trying to import the ExecDos.dll into my Inno Setups install for live logging the installation process. I copied the DLL into the folder where the .iss file is located (Downloaded it from NSIS) ...
1
vote
0
answers
67
views
How can I add comments to tooltips with OmniPascal extension
I want to see comments as tooltips in VS Code with the OmniPascal extension. Right now, comments are not appearing in tooltips despite trying different Pascal commenting styles.
Maybe i just dont know ...
1
vote
1
answer
116
views
The Dining Savages vs The Bear And The Honey Bees synchronization problem
I'm learning concurrent programming by analyzing common synchronization problems.
Right now, I'm dealing with "The Dining Savages" problem.
Note: I don't need to implement it by using ...
2
votes
2
answers
213
views
Keep Delphi In-line Assembly Labels in Assembly Blocks
Assembly is always faster than high-level languages. For example, I tested an empty loop in Delphi repeating 1 billion times, and same loop but written in assembly. The Delphi loop took 6 billion (x64 ...
0
votes
1
answer
144
views
Delphi Palette doesn't show standard/xml/net..etc components anymore (and it's causing errors)
When using Delphi, I was looking for the Timer component on the palette (VCL application). Accidentally, I pressed a button or I clicked something (I didn't notice what I did), and after what seemed ...
-1
votes
1
answer
158
views
Convert Pascal real data type to C# type [duplicate]
I'm doing a proof of concept that involves porting some Pascal code over to C#.
The code involves financial calculations, so most of the fields are currency based (though not all).
All of the numeric ...
1
vote
2
answers
246
views
How to easily and quickly apply custom indentation format rule to selected Pascal/Delphi code?
I am working with Pascal/Delphi code and need to format a selection of code with custom indentation rules (e.g. 4 spaces for indentation). I want to apply these formatting rules to the selected code ...
3
votes
1
answer
119
views
Why doesn’t rounding work outside of range?
Why does rounding not work if I try to compile following code using the FreePascal Compiler?
program RangeCheckError;
var
result: integer;
begin
result := round(1.6514384080961258e+21);
...
0
votes
0
answers
57
views
mysql_fetch_lengths() returning array of Int64 on Lazarus/Linux
In Lazarus, I am loading libmariadb.so.3 v3.3.10 via LoadLibrary(). (Did another test with libmysqlclient.so.21 v8.0.41). When iterating through the fields of a query result, the length of a value is ...
3
votes
0
answers
276
views
SAP GUI Scripting in Delphi
I am developing an application in Delphi that needs to interact with SAP GUI via Scripting to automate some material control operations. However, I am facing difficulties in establishing the correct ...
1
vote
1
answer
152
views
Delete an item from an array
So I’m writing a procedure that gives the user the choice to either delete or modify a value in an array.
The modifying part was easy, but I’m having troubles deleting the item.
Procedure ...
1
vote
0
answers
68
views
Access violation invoke Certificates_ICertificateQuery.get_Thumbprint
I try WinRT in Delphi. The following code encounter access violation when invoke get_Thumbprint:
program Sample;
uses
System.SysUtils,
System.Classes,
System.Win.WinRT,
System.NetEncoding,
...
0
votes
1
answer
157
views
TakePhotoAction crashes android app and starts again on xiaomi Android 12
Crosspost: https://en.delphipraxis.net/topic/12872-takephotoaction-crashes-android-app-and-starts-again-on-xiaomi-android-12/
Environment:
Delphi 12.2 (latest SP)
APP for Android and iOS
Hardware ...
0
votes
2
answers
77
views
SetAllPalette in Pascal
I have this function which does:
MyPalette : PaletteType;
MyPalette.Size:=16;
// sets some colors
SetAllPalette(MyPalette);
Reading the Turbo Pascal 5.0 manual it says:
Palette is an untyped ...
1
vote
1
answer
136
views
Compiler Command $M make problems with file operations in Turbo Pascal
I have problems with file operations, that when I use the $M compiler command, that file operations "sometimes" not work. They do nothing.
When I remove the $M command, than EXEC do nothing ...
1
vote
1
answer
141
views
Why is the output 16 bits when I'm only telling it to write 15?
Hello everyone once again,
I need to write a code in Pascal which converts a decimal number into a binary number, and saves this into an array, and then writes it from MSD to LSD.
I've got most of the ...
0
votes
1
answer
124
views
What is causing this? Error: Incompatible types: got "Boolean" expected "LongInt"
I am writing code for homework, however, the compiler always gives me the following error for the procedure. I honestly have no idea what is wrong about it, I cannot find the mistake. I don't know why ...
0
votes
0
answers
441
views
How to read BIOS serial number? [duplicate]
In a PC running Windows, how could I read BIOS serial number and CPU serial number?
I use pascal, Delphi7.
The reason for this is that I want to identify a PC using something unique in order to ...
-4
votes
1
answer
187
views
Kyan Pascal: compiler error "Too many indices on the closing bracket of a[t]" [closed]
In Kyan Pascal for the Commodore 64, I keep getting the error:
Too many indices on the closing bracket of a[t]
...in the first line of my first procedure:
For t := 1 to 100 do a[t] := t;
Whole ...
0
votes
1
answer
216
views
How to make a function that takes 2 dimensional array of Extended and return TArray<Extended>?
I have this function to solve 3x4 matrix by Gaussian elimination. But i got this error when running the program.
[Error] Unit1.pas(79): Identifier expected but 'ARRAY' found
[Error] Unit1.pas(79): ...
0
votes
1
answer
178
views
How can I save an INTACustomDockableForm window position in Delphi layout
The INTACustomDockableForm interface includes two methods: one for saving the window state and another for loading it.
I have implemented them as follows:
...
procedure TMyDockableForm.SaveWindowState(...
0
votes
1
answer
195
views
Why does my double-linked list display the numbers in reverse order, except for the first added number?
I wrote this code where you can add or remove numbers from a list, and then display the list. The problem is: it displays the numbers in reverse order, except for the first added number.
program ...
2
votes
1
answer
113
views
Standard Pascal 7185 silent on reading strings from textfiles
In the ISO/IEC 7185:1990(E) Standard Pascal specification, in Clause 6.9.1 for the procedure read, subsection "a)" reads as follows:
a) For n>=1, read(f,v1,...,vn) shall access the ...
1
vote
2
answers
285
views
How to print emojis using Pascal on Windows cmd/powershell
According to this table the UTF8 code for the smiley emoji is: F0 9F 98 81.
I attempt to write this output to the console, to no avail:
Program emojii;
{$apptype CONSOLE}
Begin
WriteLn(#$F0#$9F#$...
0
votes
1
answer
178
views
write a code that divides a number into several different intervals and performs special calculations for each interval
I want to write a code that divides a number into several different intervals and performs special calculations for each interval as follows.
At the end, show the sum of all the obtained numbers. I ...
1
vote
2
answers
160
views
Cascade recursion - max element in array
I'm trying to figure out how to write a cascade recursive function to find a max element in an integer array. I've tried to write some code but i think my function is more linear than cascade.
Here is ...
-1
votes
1
answer
125
views
I search a unit to solve the turbo pascal 255 string limit
is there a framework/unit that I can fill with strings to solve the 255 string limit?
Example with a loop
MyStringAllwaysWithOneString := 'X';
for i := 0 to CompleteStringLength do
begin
...
-4
votes
1
answer
178
views
Loading MP3 files into ListView. When multiple items are select, show <Multi>, need ability to save to each file even with <multi> showing [closed]
In this project, I'm opening MP3 files using the component 3delite.hu =- ID3v2 Library, and adding the MP3 files metadata to a ListView.
When you click on an item, its information appears in the Edit ...
0
votes
1
answer
316
views
Plotting a polar rose — how to use "n" and "d" to achieve different shapes?
In code form, the calculation of the coordinates of the polar rose point in the Cartesian system can be represented as follows:
X := OriginX + A * Cos(K * Theta) * Cos(Theta);
Y := OriginY + A * Cos(K ...
1
vote
0
answers
87
views
No debugger via text IDE (Go32v2)
I just installed Free Pascal v3.2.2 (within dosbox-x). Unfortunately debugging from the (go32v2) IDE doesn't work. Whatever I do, it says "no debugger support available".
Update: It seems ...
1
vote
1
answer
296
views
Is there a way to initialize all items in a 2D array in Pascal on one line (without looping)?
I know that instead of doing the following for a 1D array of Integer, arr,
SetLength(arr, 4);
arr[0] := 11;
arr[1] := 12;
arr[2] := 13;
arr[3] := 13;`
I can also do the above just on one line:
arr := ...
2
votes
1
answer
264
views
In Delphi, is it a correct approach to Free the Sender within an Event?
So, say we have a class like this:
TFieldsReadyEvent = procedure(Sender: TObject; Code, AuthorizatedID: string) of object;
TCatcherServer = class(TServer)
private
FOnFieldsReady: ...
2
votes
0
answers
427
views
How to Implement a Checksum Algorithm Based on a Written Description
I'm working on a project that is asking me to treat data coming from satellites and some frames are ended by a checksum. The ICD lists the checksum as being a "Binary 16-bit sum of data words (2 ...
-2
votes
1
answer
156
views
Why is this code used to draw a raycast vector not displaying the vector correctly?
Following the examples given in the Pascal-driven Castle Game Engine for drawing a mesh, I tried to draw a raycast vector visually using this particular piece of code for reference:
procedure ...
1
vote
2
answers
128
views
How do I properly assign integers in an array?
Im currently trying to make a binary insert program, it reads a random number and inserts it in a sorted list, but every time I execute the program it just returns a list full of 0's I had this ...
0
votes
1
answer
191
views
How to handle libnodave error message with Delphi?
I have a function that reads some values from Siemens PLC using libnodave.dll and nodave unit but I cannot figure out the error output. I am on purpose forcing to go in error and what I get from ...
1
vote
1
answer
257
views
How to find if a valid JSON string
Hello guys Is there a way to know if a string is a valid JSON type string in lazarus.
I have been using GetJSON(testString) but throws an error if string is not JSON type.
Thanks
0
votes
0
answers
101
views
How to get the names of the MIDI devices to the comboBox?
With the following code in Lazarus, I can check out how many MIDI devices there are available on my PC and put the ID numbers to the combo box:
var MyMIDIDevice : integer;
begin
cmbMIDIdevs....
0
votes
1
answer
137
views
How can I identify the mistake in my Pascal Code?
Here's the code, I don't think that there's a mistake in Read1d Procedure but each time I execute this program it displays that the value of all the elements of the array is 0. Where is my mistake?
...
0
votes
0
answers
280
views
Delphi Android service was stopped after closing the android application
I have used Delphi 12 for developing Android application and I'm trying to Service which needs to runs in the background to receive the frequent messages from Server using TCP sockets to displays the ...
2
votes
1
answer
562
views
Is there any way to enhance syntax highlighting in RAD Studio code editor?
Even if I think the title asks the question by itself, I'd like to show an example of what I'm talking about. When working with other languages, I see this:
Python in VSCode:
And working with Delphi'...
0
votes
1
answer
274
views
How to assign to an array in Pascal?
I'm getting an error I don't understand. I am trying to just assign a value to an element of an array in pascal.
function TestingThing() : Integer;
type
IntegerArray = array[0..$effffff] of Integer;...
0
votes
1
answer
103
views
Pascal - Shape Drawing
So the task is to draw this shape :
******
** **
* *
** **
******
The number of rows is set by the user,and it is labeled as n.In this case it is n=3.
So i tried splitting it in two , and i ...
2
votes
1
answer
121
views
what does this illegal expression mean in pascal? [closed]
this is the code and I get these two errors 1: 8,14 illegal expression and 2: 8,1 ''warning: variable k does not seem to be initialized
program komunaluri_1;
var
den, g, w, das, k : integer;
begin
...
2
votes
1
answer
100
views
Reset Input back to console window?
Is there any way in Free Pascal/Delphi to reset the standard Input file back to console window after it was assigned to a 'real file' temporarily?
AssignFile(Input, 'stdin.txt');
...
...
0
votes
1
answer
131
views
gotoxy command got skipped in pascal
I'm working on a school assignment. In line 87 and down, the gotoxy didn't work but the code does. Here's the cropped part of the code.
gotoxy(32,24); write(' ...
0
votes
1
answer
193
views
Can I save a Dictionary of interfaces or the inherited classes and then call Create on the sub-classes from that dictionary?
What I want to do is have a dictionary of different class types that all implement an interface or have a shared parent class. Using this list, I want to instantiate the correct one from a string ...
1
vote
2
answers
529
views
Fast Report in Delphi 11. How to print each record based on the Quantity field of the record
I have a master Detail report.
I want the report to print the master information (With its details) based on its quantity field.
So if the Quanitty field of master record is 3 it should show up 3 ...
-1
votes
3
answers
681
views
Illegal Expression on Pascal
program latihan;
uses crt;
var
a, b, c : integer;
d : real;
begin
write('a: ');
readln(a);
write('b: ');
readln(b);
c := a + b;
d := a + b;
sqr(c);
writeln(c);...