Questions tagged [pchar]
33 questions
1
vote
3 answers
Delphi - Problem With Set String and PAnsiChar and Other Strings not Displaying
I was getting advice from Rob Kennedy and one of his suggestions that greatly increased the speed of an app I was working on was to use SetString and then load it into the VCL component that displayed it.
I'm using Delphi 2009 so now that PChar is…

Brian Holloway
- 205
- 4
- 15
1
vote
1 answer
Delphi DLL PChar
This limitation for sharedMemory is actual ?
I have passed to DLL string length around 370 chars and DLL read it without problem.
I am asking, because I return PChar from DLL to EXE program.
In DLL I use GetMem() function, and in EXE program I used…

InnerWorld
- 585
- 7
- 26
0
votes
1 answer
Why it's not allowed to print the content of PChar as a pointer
I have the following program.
var a: PChar := PChar('abc');
ShowMessage(Format('%p - %p', [@a, a]));
When I run it, I got this error:
Project Project1.exe raised exception class EConvertError with message 'Format '%p - %p' invalid or incompatible…

Fajela Tajkiya
- 629
- 2
- 10
0
votes
1 answer
How can I convert a PCHAR* to a TCHAR*?
I am looking for ways to convert a PCHAR* variable to a TCHAR* without having any warnings in Visual Studio( this is a requirement)?
Looking online I can't find a function or a method to do so without having warnings. Maybe somebody has come across…

Ioana
- 53
- 7
0
votes
0 answers
How to determine throughput/bandwidth from a file captured
I need to determine the throughput available between TCP client/server based on a packet capture.
I would be very grateful if someone would indicate a script or tool that allows me to extract the throughput or network bandwidth from a pcap file and…

Laura
- 11
- 3
0
votes
2 answers
How can i use PChars correctly to improve this optimization?
I have a function that is called heavily in my app. It is basically a csv parser, which 'pops' the first value off and changes the input string to the remaining string.
function StripString(mask: string; var modifiedstring: string): string;
var
…

Simon
- 9,197
- 13
- 72
- 115
0
votes
2 answers
Call VisualBasic DLL in C# works but how to replace a Pchar?
i have an old DLL written in VisualBasic and need to call the functions in C#.
14 of the 15 functions a already running (Tested with console project). The remaining function has a paramater PChar where i dont know how to call it in C#.
A working…

Thomas Mann
- 99
- 3
- 19
0
votes
2 answers
delphi modify pchar at runtime
I need to modify pchar string at runtime.
Help me with this code:
var
s:pChar;
begin
s:='123123';
s[0]:=#32; // SO HERE I HAVE EXCEPTION !!!
end.
Now i have exception in Delphi 7 !
My project is not using native pascal strings (no any…

Vadim Kaplan
- 3
- 1
0
votes
2 answers
What's the correct way to assign PAnsiChar to a (unicode-) string?
I have got a DLL function that returns a pointer to ANSI text (PAnsiChar). I want to assign this to a (unicode-) string (This is Delphi XE2.). The following compiles but I get a warning
"W1057 Implicit String cast from 'AnsiChar' to…

dummzeuch
- 10,975
- 4
- 51
- 158
0
votes
0 answers
What have I missed in this custom format copy and paste?
My copy code:
if OpenClipboard(mainwnd.Handle) then
MemHandle := GlobalAlloc(GHND or GMEM_SHARE, Succ(StrLen(pLclCopies)));
if MemHandle <> 0 Then
Begin
try
StrCopy(GlobalLock(MemHandle), pLclCopies);
GlobalUnlock(MemHandle);
…

Chucky
- 1,701
- 7
- 28
- 62
0
votes
1 answer
How to create and edit a global PCHAR without any memory leak
This might seem like a basic question, but I can't find a solution anywhere.
I have to get Information out of a kernel mode. Therefore i work with an IOCTL.
My User-Mode-Applications sends this IOCTL using DeviceIoControl with METHOD_OUT_DIRECT…

plomox
- 5
- 1
0
votes
2 answers
Calling external dll with array of pchar as parameter in XE
I have a delphi project that works fine in delphi 6, but when I upgraded to XE it does not work.
I know it has to do with the new unicode type in delphi XE, I have tried changing the definition of the parameter from pchar to pansichar, ansichar but…

Mario Villada
- 35
- 2
- 6
0
votes
3 answers
Pass vector* to function getnameinfo
how it is possible to pass variable of type vector* into getnameinfo function of winsock2?
GetSocketIPAndPort( struct sockaddr* ss, vector* pIP, uint16_t* nPort )
{
if (status =…

Benyamin Jane
- 407
- 2
- 5
- 16
-1
votes
1 answer
get PChar argument back from Delphi DLL in my Python script
Let say that I've this function in a DLL
function test_3(sInput, sOutput : PChar; sSize : int64): Integer; stdcall;
var
sTmp : string;
fText : TextFile;
begin
sTmp := '+++ ' + sInput + ' +++';
StrPLCopy(sOutput, PChar(sTmp), sSize);
Result…

Jean-Philippe
- 173
- 10
-1
votes
1 answer
How to pass a string containing a file path from C# to a function in a Pascal DLL requiring a PChar argument?
How can I pass a string containing a file path from C# to a function in a Pascal DLL requiring a PChar argument?
The Pascal DLL has a "FileExists" call that checks if the Argument (AFile: PChar) exists as a file.
I've imported the dll succesfully…

The Agony
- 138
- 1
- 8