Execute a program using a C program [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
is it possible to write a C program that reads another program line by line and make it(2nd program) execute? please help

Yes.
But the details are complicated and depend on many things that you don't specify in your question.
What language is the second program written in?
Why you want to do this will affect how it should be done
Are you looking to control the 2nd program in some advanced way?
etc.

yes, with exec on unix and ShellExecute on windows

It's called an interpreter. Google for "C interpreter".

Read in the program, put it into a file, compile, link and execute it?
C isn't Perl if that is what you are looking for.
Frank

Yes. It is not only possible, but done all the time. UNIBASIC & UNIBASIC DL4 are two of the languages that I've used that are written in C.

Related

read assembly file in C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a project that I have to make a parser in C (first milestone) that it read an assembly file, e.g
goto:
goto:
L.D F0,0(R1) #### comments
ADD.D F4,F0,F2 #### more comments
S.D 0(R1),F4 ###
DSUBUI R1,R1,8 ####
BNEZ R1,goto
L.D F0 0X00A0100
MAYBE 10000 instructions (after that...)
I am thinking of doing this by using arrays....is there a better way of doing this? Also I have to simulate Tomasulo's algorithm using the commands I read from the file.
You're unlikely to get much help here with such a general question.
There are existing MIPS assemblers that do parsing which might provide you with some ideas, or at least some better questions:
http://code.google.com/p/mips-assembler-unb/source/browse/trunk/src/MIPS+Assembler/
...but clearly you'll be setting yourself up for a world of pain if you try using anything like that directly for a class project!
The best source for guidance if you're going to be graded will come from the person who's going to end up giving out the grade. Admit your confusion and ask for help directly. But go with a very clear map of what you did understand, and the point where your understanding stopped.
(This question doesn't demonstrate that kind of clarity, and your teacher will probably be unenthusiastic—much like the community here—if you put it to them in the same way.)

Get Size Of File From Commandline Input In C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to get the size of a file from the commandline in C using argv. I'm not too familiar with file i/o in C, so any pointers would be greatly appreciated. Thanks.
You've not stated the platform, but your C program is given an argument list when it is started, and the file names are strings. The POSIX function you'd probably use is stat(); it takes a pointer to a struct stat and will put the file's size into the st_size member of the structure.
The answer may be different on Windows; the POSIX subsystem will provide a stat() workalike (probably named _stat()), but there'll also be a native interface.

sending variables to procedures in c and pascal [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
for sending variables to procedures what we should do in c and(or) pascal?
as i searched this work has to be done by BP( base pointer)
or rather i should say that BP do it,and one more thing is that C and Pascal are opposite of each other.
You question is entirely unclear. It would appear that you might be asking about C and Pascal calling conventions on the x86 architecture (at least your mention of BP hints at this).
If that's the case, I'd recommend you study the Wikipedia page on x86 calling conventions, and come back when you have specific questions.
edit You might also want to check out X86 Assembly/High-Level Languages along with the "Further Reading" links therein.

Printing a variable from a C routine [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I do not know how to use "C", but have a working C program that I need to print a
program variable to determine what the program is doing. Can you tell me the easiest
way to do this
Jack
to print on stdout use printf function from stdio.h
To watch the values of a particular variable in Turbo c (windows)
Window-> watch -> enter your variable name. Then Press F7.
You can able to keep track the value of the variable.

how to build a calculator in GTK+? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
what's the logic behind the calculator widget. i want to build it in gtk+.
First, don't listen to anyone who says that this is trivial.
Second, I'm going to assume that you really mean something like "How do I convert the user input to an internal expression structure which I can use to calculate the answer?". Well, Wikipedia has a good article (here) on converting infix (human readable) notation, which is what most modern calculators use (e.g you can write 1 + 2 instead of + 1 2), to the more computer appropriate polish (prefix) notation.
Third, if you don't know GTK+ yet, start here.
Hope this helps.

Resources