Common programming languages (PL), e.g. Python allow append lines to opened file like file_object = open('sample.txt', 'a').
How it is possible to do in expl3 PL? My MWE adds only last argument of \somemacro. Please point to the right place in Interface3 how to do it.
\documentclass[]{article}
\ExplSyntaxOn
\iow_new:N \l_totoc_iow
\NewDocumentCommand{\somemacro}{ m }
{
\iow_open:Nn \l_totoc_iow {\g_file_curr_name_str.dat}
\iow_now:Nn \l_totoc_iow { #1 }
\iow_close:N \l_totoc_iow
}
\ExplSyntaxOff
\begin{document}
\somemacro{tofile}
\somemacro{tofile2}
\end{document}
\l_pkgname_totoc_iow(note the suffix). – frougon Jun 07 '22 at 10:42\iow_close:N \l_totoc_iow– egreg Jun 07 '22 at 10:53.auxfile and writes all other write instructions into it (and keeping many files open is unpracticable if you only can open a dozen or so) – Skillmon Jun 07 '22 at 11:00