m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can an M4-program read data out of an C-program?


From: Raphael 'kena' Poss
Subject: Re: Can an M4-program read data out of an C-program?
Date: Mon, 22 Mar 2010 11:04:57 +0100

Op 22 mrt 2010, om 10:59 heeft Amaury Ampe het volgende geschreven:
> Is this done by using the sprintf command or can I just write it like that in 
> my C-program?

use fprintf, like this:

  FILE *f = fopen("themacros.m4", "w");
  for (i = 0; i < N; ++i)
     fprintf(f, "m4_define([NAME%d], [%s])\n", i, your_data_for_item_i);
  fclose(f);

  system("m4 themacros.m4  thetemplatecode.m4 >output.c");


But my advice would be that you should really ask for help with this, or learn 
some basics on programming. Otherwise you will run quickly into issues and this 
mailing list is not intended to help with programming C.


-- 
Raphael 'kena' Poss · address@hidden · +31 20 525 7559
UvA · FNWI · IvI · CSA · 1098XG 107 Amsterdam (NL)
z = \f. (\x. f (\y. x x y)) (\x. f (\y. x x y))
There is no spoon, only fork() and vfork().








reply via email to

[Prev in Thread] Current Thread [Next in Thread]