Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Incompatible typen - string und pchar (https://www.delphipraxis.net/10750-incompatible-typen-string-und-pchar.html)

agm65 24. Okt 2003 14:01


Incompatible typen - string und pchar
 
hi leute, ich mal wieder...
folgendes problem zu folgender zeile code:

Incompatible typen - string und pchar

MoveFile(pchar(Filepath),WinDir + '\'+ pchar(Filepath);

danke für hilfe

cu agm65

Christian Seehase 24. Okt 2003 14:03

Re: Incompatible typen - string und pchar
 
Moin agm,

der erste Parameter ist doch Ok, und der zweite wird angemeckert.
Wie also muss der zweite Parameter geändert werden, damit er so wie der zweite aussieht?

mirage228 24. Okt 2003 14:11

Re: Incompatible typen - string und pchar
 
wie wärs mit

Delphi-Quellcode:
PChar(IncludeTrailingBackslash(WinDir) + FilePath);
Falls du die Funktion IncludeTrailingBackslash nicht hast, kannst du immer noch WinDir+'\'+FilePath in die Klammer schreiben

mfG
mirage228

agm65 24. Okt 2003 15:38

Re: Incompatible typen - string und pchar
 
nein also das hat alles nichts gebracht...gibts sowas wie inttostr für pchar ?

Christian Seehase 24. Okt 2003 15:45

Re: Incompatible typen - string und pchar
 
Moin agm,

Zitat:

Zitat von agm65
nein also das hat alles nichts gebracht...

ich weiss zwar nicht was Du gemacht hast, aber irgendwie muss es falsch gewesen sein:

So muss es gehen
Delphi-Quellcode:
MoveFile(pchar(Filepath),PChar(WinDir + '\'+ Filepath));
Voraussetzung: FilePath und WinDir sind vom Typ String.

Wenn ich mir das noch einmal genau ansehe:
Compilieren wird dann gehen, aber funktionieren wird es doch nicht, weil ich vermute, dass FilePath auch das Laufwerk enthält.
FilePath beim zweiten Parameter solltest Du noch einmal überdenken.

agm65 24. Okt 2003 15:51

Re: Incompatible typen - string und pchar
 
jo thx das geht


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz