[PD] A quick question for C dev - temp file on windows

Pierre Alexandre Tremblay tremblap at gmail.com
Thu Jun 23 15:36:36 CEST 2022


In an external I use the superb tmpnam(x) to generate a temp file path to use and delete. All is good then… for MacOS and Linux that is! In Windows, the code in C does create a file but when I try to pass it to TCL to open there, like in the amazing ELSE’s pic, I can’t - the inverted backslash are deleted. I tried also, like in else, using open_canvas to no avail.

Now I tried to use on windows the ELSE’s pic to troubleshoot and it seems I have 2 problems:


- PIC will accept the file I create when it is on the Documents folder, but not the exact same file in the temp folder created by tmpnam. So this will work:
open C:/Users/pa/Documents/tmp.0.8eDtGO

But not this:
open C:/Users/pa/appData/Local/tmp.0.8eDtGO



- PIC will only accept with straight slashes / 


Won’t work but




So I wonder if there are pearls of wisdom on temp file generation for cross OS compile. At the moment, if I use the PIC hack of going through canvas_open I get a ‘void’ name, and if I don’t I get errors due to the backslash not being digested by TCL (it seems - the error is as above)


Ps Alexandre, without you and your code, this object would not exist, so 39402940923 thanks!

More information about the Pd-list mailing list