How do I write DXF text to stdout?

I use DL_WriterA to write DXF text to some.dxf file. Is there any way to redirect DXF text to stdout?

Not directly from dxflib. You’d have to generate a temporary file and then stream it to stdout.

I use ‘tmpnam’ to generate temporary file name although the manual page on ‘tmpnam’ does not recommend to use this function:

#man 3 tmpnam
…
BUGS
Never use this function. Use mkstemp(3) or tmpfile(3) instead.
…

Could you recommend more coorect way to generate temporary file for writing DXF data?

The man page seems to suggest ‘Use mkstemp(3) or tmpfile(3) instead.’

I haven’t used these lately, but according to their man pages they might provide what you are looking for.

DL_WriterA requires file name as parameter while these (safe) functions return file descriptor or stream – not file name.

You are right. dxflib would have to be adjusted to work with those functions.

A possible solution might be to create a temporary directory instead of a file using mkdtemp.
You could then create file(s) inside that directory with any fixed or dynamic name(s).