Dynamic filename via concatenation?

0 views
Skip to first unread message

paul.s...@telenet.be

unread,
Apr 7, 2026, 11:42:22 AMApr 7
to filtermeister
Hi All,

For writing data to .cvs text, it would be useful to be able to change the filename dynamically via concatenation. Currently, I have to rename the already saved file every time or place it in a different folder to avoid overwriting.

For example, I use the filename
"Pix2Text_00",
"Pix2Text_01", etc...
to have an incrementing numbering.

Or another possibility would be to use date and time as a prefix
strdate( str0); strtime( str1);
"2026/04/07-17:24-Pix2Text"
to never have a duplicate filename.

I haven't managed to get this to work as a path. Is there a solution or workaround possible within FM?

In short, this is the method:
- Pixel values ​​are scanned and placed in an Array.
- The Array is read to a pointer and written to a file.

int iA0; 
void* iv00; 
allocArray( 0, x, y, 0, 4); 
... 
putArray( 0, x, y, 0, src( ix0, iy0, 0)); 
iv00 = fopen( "C:\\FM\\TestData\\Pix2Text_00.txt", "w"); 
... 
iA0 =getArray( 0, ix0, iy0, 0); 
fprintf( iv00, "%d,", iA0);


Kind regards,
Paul Simoens


Duncan Suss

unread,
Apr 8, 2026, 8:35:00 AMApr 8
to filtermeister
Hi Paul,

Have you tried using strcat to add a simple prefix (or suffix) to the filename? By simple, I mean NOT  "2026/04/07-17:24-Pix2Text" which contains some characters that are very likely to upset the compiler or the operating system or both. Try no slashes and no colons - e.g. "2026_04_07_17_24_Pix2Text" 

It's been a long time since I wrote any FM or C code, the problem might be way deeper than just the characters you chose to name the file.

Regards,

Duncan


--
You received this message because you are subscribed to the Google Groups "FilterMeister Mailing List (FMML)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to filtermeiste...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/filtermeister/281581172.74395477.1775576538361.JavaMail.zimbra%40telenet.be.

paul.s...@telenet.be

unread,
Apr 9, 2026, 12:53:16 PMApr 9
to filter...@googlegroups.com
Working with strings remains a blind spot for me due the missing of concrete examples (of this kind).
Key is to concatenate a filename that will be accepted as a path.
I found this in the FM-Wiki. Can some of you complete this to a working example?
E.g. "Pix2Text_" + ctl( 0) +".txt"
becomes "Pix2Text_00.txt" ?

To be used as:
iv00 = fopen( "C:\\FM\\TestData\\Pix2Text_00.txt", "w"); 

- - - - - - -

Syntax
char* strcat(char *dest, const char* src)

Arguments
dest
The destination string to which the source string is to be appended.
src
The source string to be appended on the destination.


Regards, Paul




Van: "Duncan Suss" <dunc...@gmail.com>
Cc: "filtermeister" <filter...@googlegroups.com>
Verzonden: Woensdag 8 april 2026 14:34:45
Onderwerp: Re: [FMML2] Dynamic filename via concatenation?

Duncan Suss

unread,
Apr 9, 2026, 7:52:28 PMApr 9
to FilterMeister Mailing List (FMML)
I don't have a PC with FM installed these days, but I might be able to put together some code in C that could point you the right direction. It'll take me a couple of days - if anyone else can help you will likely get a faster and better piece of test code.

Duncan

--
You received this message because you are subscribed to the Google Groups "FilterMeister Mailing List (FMML)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to filtermeiste...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages