[fpc-pascal] mciSendString with long file names

Travis Siegel tsiegel at softcon.com
Thu Sep 22 21:26:41 CEST 2022


That's on windows, you said the program was running on linux.  In that 
case, backslashes will escape the spaces, allowing the path to be found 
properly.

Windows paths are different, as mentioned before, they can be escaped 
too, but the character is different.

On 9/22/2022 2:57 PM, James Richters via fpc-pascal wrote:
> Won’t backslashes before each space be defining a subdirectory?
>
> If my path looks like:
> C:\Program Files\My Program\Some File.MP3
> I don't see how changing it to:
> C:\Program\ Files\My\ Progam\Some\ File.MP3 can possibly work.. it's just butchering the path.
>
> James
>
>
> From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Travis Siegel via fpc-pascal
> Sent: Wednesday, September 21, 2022 4:15 PM
> To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
> Cc: Travis Siegel <tsiegel at softcon.com>; Jean SUZINEAU <jean.suzineau at wanadoo.fr>
> Subject: Re: [fpc-pascal] mciSendString with long file names
>
> Adding a backslash (\) before each space should do the job nicely.  I have had similar issues on linux and windows with some commands, and adding the escape characters to the filename almost always fixes the problem.  The only time it didn't, was when the filename started with a dash "-" character.  Otherwise, the backslash always works for me.
>
> On 9/20/2022 4:16 PM, Jean SUZINEAU via fpc-pascal wrote:
> 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:
> Var
> pcmd: String;
> MyFileName: String;
>   
> pcmd:='play "'+MyFileName+'"'+#0;
> mciSendString(@pcmd[1],Nil,0,0);
>   
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  mailto:fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list