473,587 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compiling a C program through another C program

As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?

Sep 29 '07 #1
62 3120
On Sep 28, 8:29 pm, Ajinkya <kaleajin...@gm ail.comwrote:
As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?
Command in unix platform will do too...

Sep 29 '07 #2
On Sep 28, 10:29 pm, Ajinkya <kaleajin...@gm ail.comwrote:
As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?

spawnl is not a standard C function and so is OT, and the details of
running compilers is also OT, but something like "system("cl
myprog.c");" might do the trick on some platforms, assuming the
environment is set up correctly.

Sep 29 '07 #3
Ajinkya wrote:
On Sep 28, 8:29 pm, Ajinkya <kaleajin...@gm ail.comwrote:
>As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?

Command in unix platform will do too...
You might try:

system("cc file.c");

Of course you can supply other options to cc too.

Sep 29 '07 #4

"Ajinkya" <ka*********@gm ail.comwrote in message
news:11******** *************@5 0g2000hsm.googl egroups.com...
As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?
Depending what you want to do you might want to look at my Basic interpreter
(on the website, also available as a book).
It shows how to put scripting into C programs.

(Modifying it to be C interpreter rather than a Basic interpreter is I'm
afraid a much bigger job than it might seem at first sight).

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Sep 29 '07 #5
In article <11************ **********@y42g 2000hsy.googleg roups.com>,
"ro***********@ yahoo.com" <ro***********@ yahoo.comwrites
>On Sep 28, 10:29 pm, Ajinkya <kaleajin...@gm ail.comwrote:
>As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?


spawnl is not a standard C function
Yes
>and so is OT
No it's not.
>, and the details of
running compilers is also OT,
No they are not.
but something like "system("cl
myprog.c");" might do the trick on some platforms, assuming the
environment is set up correctly.
Spawn, fork etc start a separate process

System() and the like are used to start an external program. Of course
if as might be the case on windows the compiler might be a DLL which
means you could call it without using system()
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Sep 29 '07 #6
On Sep 29, 7:49 pm, Chris Hills <ch...@phaedsys .orgwrote:
spawnl is not a standard C function
and so is OT

No it's not.
Yes it is
, and the details of
running compilers is also OT,

No they are not.
Yes they are

Spawn, fork etc start a separate process
The terms "spawn", "fork" and "process" have no meaning in the context
of the C language
System() and the like are used to start an external program. Of course
if as might be the case on windows the compiler might be a DLL which
means you could call it without using system()
OT

Regards,
B.

Sep 29 '07 #7
Chris Hills said:
In article <11************ **********@y42g 2000hsy.googleg roups.com>,
"ro***********@ yahoo.com" <ro***********@ yahoo.comwrites
>>On Sep 28, 10:29 pm, Ajinkya <kaleajin...@gm ail.comwrote:
>>As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?


spawnl is not a standard C function

Yes
>>and so is OT

No it's not.
You're right - it's completely topical, provided only that we can find the
source code for it. Fortunately, I have *found* the complete source code
to spawnl:

void spawnl(char *target, const char *source)
{
while(*source != '\0')
{
*target++ = *source;
if(*source++ == 'l')
{
*target++ = 'l';
}
}
*target = '\0';
}
Spawn, fork etc start a separate process
Not here they don't. Here, Spawn() moves a pawn one place to the South, and
fork() draws a Y-shaped object (like a fork in the road) on a bitmap.

If you think I'm wrong, please show me where the C Standard makes this
clear.
System() and the like are used to start an external program.
On my system, it's system() that does that. System() does something else
entirely. C is a case-sensitive language.
<snip>

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 29 '07 #8
In article <11************ *********@w3g20 00hsg.googlegro ups.com>,
bo*******@gmail .com writes
>On Sep 29, 7:49 pm, Chris Hills <ch...@phaedsys .orgwrote:
>spawnl is not a standard C function
and so is OT

No it's not.

Yes it is
No it's not. As a regular here for the last 14 years I say it is ON
topic.
>
>, and the details of
running compilers is also OT,

No they are not.

Yes they are
No they are not.
>Spawn, fork etc start a separate process

The terms "spawn", "fork" and "process" have no meaning in the context
of the C language
Yes they do.
>System() and the like are used to start an external program. Of course
if as might be the case on windows the compiler might be a DLL which
means you could call it without using system()

OT
That's right ON topic.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Sep 29 '07 #9
In article <0d************ *************** ***@bt.com>, Richard Heathfield
<rj*@see.sig.in validwrites
>Chris Hills said:
>In article <11************ **********@y42g 2000hsy.googleg roups.com>,
"ro*********** @yahoo.com" <ro***********@ yahoo.comwrites
>>>On Sep 28, 10:29 pm, Ajinkya <kaleajin...@gm ail.comwrote:
As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?
spawnl is not a standard C function

Yes
>>>and so is OT

No it's not.

You're right - it's completely topical,
Oh good.
>Spawn, fork etc start a separate process
If you think I'm wrong, please show me where the C Standard makes this
clear.
Unless you are on comp.std.C that is not relevant. If you personally
(and a small group of vocal net nannies) want to artificially restrict
yourselfes (only) to something the rest of us don't want that is up to
you.

However as a member of the ISO C and MISRA -C groups I have to disagree
with your artificial and incorrect view of topicality on this NG.

If you don't like it not partake of those threads otherwise stop
polluting this NG with your pedantic OT whining.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Sep 29 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2251
by: Jung Joon Park | last post by:
Hi everyone. I am JJ Park. I got some questions in C++. First of all, my English is not perfect, because I am foreigner. I have got C++ code, which have no syntex error in Visual C++ ver6.0 compiling, however, this code was made in Sun systems (UNIX based). I shall change the C++ code unix > Window based. And this code contain "calling...
4
1753
by: Eranga | last post by:
I want to add a program to windows which will run at a specified time period which may be changed by the administrator.What I plan to do is start the program at windows startup and then within that program check for the correct time to run. Then when the time is equal to the seted time another program is called Up to this point I can write...
0
2020
by: federico | last post by:
Hello, how can I make a program respond to another program's input request? For example, this code: Process.Start("unrar.exe", "e D:\temp\key.rar D:temp2") SendKeys.SendWait("test~") will successfully start a program that prompts for a password, and then submit the password via SendKeys. SendKeys will work with both console and...
4
1585
by: Opettaja | last post by:
I am trying to make a program that times how long it takes to do something in another program. Is there away to make my timer program listen for a dialog box to open on the other program and then perform some functions in my timer program? I do not have the source code for the program I am trying to listen to. Does anyone know how/if I can do...
18
7511
by: utab | last post by:
Dear all, I am making a system call to the well known Gnuplot with system("gnuplot"); gnuplot opens if I only supply this command but I would like to pipe that command line in my C++ program. For example I want to run a very simple command like "plot sin(x)". So after running another program, what is the way to pipe that with some...
1
1788
by: Netaro | last post by:
Well... So, i have a program. A normal program, which does something, and so.. and i have another program, which wants to run the first program.... So, there are 2 questions about that problem -> 1) How can i run the program using another program? Is there anything like runProgram(Directory,Name.exe)? 2) Programs usually returns the 0...
0
1086
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
Hi, We want to write a program (Prog_A) to check the activities of another program (Prog_B). If there is no activity on the Prog_B for a period of time, the Prog_A need send a message to close the Prog_B. Is it possible to write a program to check the activities of another program in C# ? Thank you in advance!
2
6892
by: jrbush82 | last post by:
I am trying to read the standard out of another program into an array or string in my C++ program. I need to read each line individually because based on the output depends on what the program will do. Example output of the other program is: www.thescripts.com|/|192.168.1.10|75.126.163.34|37281|80|1...
1
3175
by: WackoZacho | last post by:
I've tried searching on Google and for other questions similar to mine, but all I get are results on how to use the LostFocus event or Deactivate, etc., but I'm under the impression each of these applies to controls on a form, or the actual form itself. What I need is a way to determine when my access database looses the focus entirely to another...
4
2689
by: maximus tee | last post by:
hi all, i wrote a simple GUI with 2 buttons. Button1 is to launch another program. Button2 is to run test. When I click Button1, it will launch another program. After launching the program, my GUI window is still waiting until i exit the program. How can the GUI window gain control after launching another program? i used os.system to launch...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.