How to generate a file which contains the def. of a funct.

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

How to generate a file which contains the def. of a funct.

Postby fuchi » Mon Sep 19, 2005 12:57 am

In the file makeFoo2.c I have a main function that prints the code that will end up in the file
foo2.c. The function foo2() prompts for who you want to say 'Hello' to, reads the string from stdin and returns that string.

The file foo2.c , which contains the defintion of the function foo2() needs to be generated by an invocation of makeFoo2.c file.

I am not sure how to do this all.

If any ideas, please help.

Thanks
fuchi
 
Posts: 1
Joined: Mon Sep 19, 2005 12:44 am

RE: How to generate a file which contains the def. of a func

Postby jjmac » Mon Sep 19, 2005 1:56 am

Would that be ...

Code: Select all

#include <stdlib.h>
int system (const char * string);
system()  executes  a command specified in string by calling /bin/sh
       -c string, and returns after the command has been completed.  During
       execution  of  the  command, SIGCHLD will be blocked, and SIGINT and
       SIGQUIT will be ignored.


You could possibly just echo it to the file ... there must be a better way though (grin)


jm
http://counter.li.org
#313537

The FVWM wm -=- www.fvwm.org -=-

Somebody stole my air guitar, It happened just the other day,
But it's ok, 'cause i've got a spare ...
jjmac
LXF regular
 
Posts: 1996
Joined: Fri Apr 08, 2005 1:32 am
Location: Sydney, Australia


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron