How do I write DXF text to stdout?
Moderator: andrew
-
- Newbie Member
- Posts: 3
- Joined: Sat Mar 24, 2012 5:14 pm
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?
Re: How do I write DXF text to stdout?
Not directly from dxflib. You'd have to generate a temporary file and then stream it to stdout.
-
- Newbie Member
- Posts: 3
- Joined: Sat Mar 24, 2012 5:14 pm
Re: How do I write DXF text 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?
#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?
Re: How do I write DXF text to stdout?
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.
I haven't used these lately, but according to their man pages they might provide what you are looking for.
-
- Newbie Member
- Posts: 3
- Joined: Sat Mar 24, 2012 5:14 pm
Re: How do I write DXF text to stdout?
DL_WriterA requires file name as parameter while these (safe) functions return file descriptor or stream -- not file name.
Re: How do I write DXF text to stdout?
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).
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).