1

Topic: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Earlier wrote a small script on a python that in an automatic mode  connections to a web to the server, analyzed and generated white sheet. Now decided to try similar to make on delphi as it in turn received update before support unix x64 machines.
Earlier on a python:

System ("sudo tcpdump-v-n-w attack.log dst port 80-c 2000");

And as on delphi to cause - did not find the answer. Looked as in lazarus it is implemented - did not approach. AProcess and in  is not present close.
I.e. the alternative to ours ShellExecute from under windows, on unix machines is necessary.

2

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

https://stackoverflow.com/questions/444 … pplication

3

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel;

program Project1;
uses
Posix. StdLib;
begin
_system (' ls');
end.

4

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

The first variant did not approach, as very bulky. I it saw earlier.
The second variant - the absolute. Thanks!
All turned out at me, I thank you!

5

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Kazantsev Alexey, there was one more question as the answer to write down. On the given example names of files in any string/multiline data type?

6

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

there was one more question as the answer to write down. On the given example names of files in any
String/multiline data type?

Suddenly it is necessary to study "very bulky" variant.

7

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

there was one more question as the answer to write down

In the first offered variant, just there is an output reading. But it is possible and is easier...

tnAnGel wrote:

On the given example names of files in any string/multiline data type?

program Project1;
uses
System. Classes, Posix. StdLib, Posix. StdIo;
var
fn: Utf8String;
ls: TStringList;
s: String;
begin
fn: = ' /tmp/randomName.txt ';
_system (MarshaledAString (' ls> ' + fn));
try
ls: = TStringList. Create;
ls. LoadFromFile (fn);
finally
remove (MarshaledAString (fn));
end;
writeLn (' - - ');
for s in ls do
writeLn (s);
writeLn (' - - ');
ls: = nil;
end.

8

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Kazantsev Alexey, , you all the same write down a file on a disk before deduce. I thought that it is possible to place at once the answer in StringList as access from storage faster, rather than from a disk, especially when the server is overloaded also big kol-in operations in the variant offered by you above not to eat well for my purpose smile
Whether probably somehow without disk writing it to implement?

9

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Whether

tnAnGel wrote:

Probably somehow without disk writing it to implement?

Probably. It is necessary to study "very bulky" variant.

10

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

All 15 lines.

11

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Dimitry Sibiryakov, I understood, what made a reservation considerably ridiculously, but it not seems to you, what embarcadero should provide the similar scenario of succession of events?
I now consider the given variant. Earlier I it supposed in a coin box of possible candidate solutions.

12

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Whether

tnAnGel wrote:

Probably somehow without disk writing it to implement?

In the first variant becomes without record.

tnAnGel wrote:

as access from storage faster, rather than from a disk, especially when the server is overloaded also big kol-in operations in the variant offered by you above not to eat well for my purpose smile

Depends on adjustments./tmp can be quite mounted as tmpfs , therefore disk operations there at all will not be.

13

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

it not seems to you, what embarcadero should provide the similar scenario of succession of events?

No. It is clear that they do Delfi for the full teapots, but to create components for
in them of ten lines of the procedural code on all chances - above them
Possibilities. Buttons "to make the program" it not to create.

14

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Kazantsev Alexey;
....And still is/dev/shm:-D

15

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Kazantsev Alexey, I understood you, thanks for the help. At me has been mounted as the directory. I will make still to myself ramfs as you advised above.
Dimitry Sibiryakov, it agree, but after all this most banal that can be demanded by development under linux. Understand, it is made _system for input of direct commands in this OS, and for a result output - invent?
And into account Delphi: I consider that this environment is necessary for fast draft development in view of its simplicity and fast rate of development, rather than on any the friend the higher .

16

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

and for a result output - invent?

And for "a result output" - is more exact for result interception - there are standard files STDIN, STDOUT and STDERR, described in any book on S.Kstati and in Pascal there are standard files Input and Output, here Error are not present, would be visible to schoolboys too difficult.

17

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

Understand, it is made _system for input of direct commands in this OS

Not for input, and for start. Input in _system is not present.
If you walk to a triggered command to feed any input - that it is necessary to write down too it standard file functions. To similarly reading of a file of an output under the link.

18

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

I understood All of you. Thanks for answers.

19

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

Delphi: I consider that this environment is necessary for fast draft development in view of its simplicity and fast rate of development

tnAnGel wrote:

Earlier wrote a small script on a python that in an automatic mode  connections to a web to the server, analyzed and generated white sheet. Now decided to try similar to make on delphi

And the Python for "fast draft prototyping" does not approach?.:-o

20

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Arioch wrote:

.... And still is/dev/shm:-D

Generally, if to follow spirit and to a letter for communications between a software there is a separate directory, to learn about which it is possible from a variable of surrounding XDG_RUNTIME_DIR wink

21

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

Understand, it is made _system for input of direct commands in this OS, and for a result output -
Invent?

_system () it is an one-line wrapper for function GLIBC. Just the same wrappers are for
popen () and fread (). And to combine them in a cycle - here the programmer it is necessary. For anybody
In advance not in course what application will be caused, what volume and type returned will be
It of given etc., etc.
If caused application returns 10 gigabyte of binary garbage - in what TStringList
You will lay down it? And, by the way, a result location in TStringList -
Initially not so good idea.

22

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Dimitry Sibiryakov, the data will be not big. No more 40-50 in the worst variants in unit of time.
You have sentences? As I plan to use either StringList, or StringStream. All depends that I will want to make further.
From this that now I am going to make: reading and the analysis of dens tcpdump, senginx, apache. Further record in a database and server monitoring.

23

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

As I plan to use either StringList, or StringStream. All depends that I will want to make further.

It is possible to do serial reading of the text file, without loading of lines in StringList.

24

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

Kazantsev Alexey, well, I will consider your council. Just all is in the RAM and access time will be as much as possible fast.

25

Re: RAD Studio 10.2 - how to cause any application from unix environment? Development under win for unix.

tnAnGel wrote:

that now I am going to make: reading and the analysis of dens tcpdump, senginx, apache.

. What for the utility you were going to cause? Really ' cat '?.
It is enough for reading of text dens TextFile.