Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
fuchi



Joined: Mon Sep 19, 2005 1:44 am
Posts: 1

PostPosted: Mon Sep 19, 2005 1:57 am    Post subject: How to generate a file which contains the def. of a funct. Reply with quote

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
Back to top
View user's profile Send private message
jjmac
LXF regular


Joined: Fri Apr 08, 2005 2:32 am
Posts: 1996
Location: Sydney, Australia

PostPosted: Mon Sep 19, 2005 2:56 am    Post subject: RE: How to generate a file which contains the def. of a func Reply with quote

Would that be ...

Code:


#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 ...
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast