[fpc-pascal] mciSendString with long file names

Travis Siegel tsiegel at softcon.com
Wed Sep 21 22:14:31 CEST 2022


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  -fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220921/95107bbd/attachment.htm>


More information about the fpc-pascal mailing list