• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 394
  • Last Modified:

program.c to .bat, possible? how?

Hello,

not sure if possible or not... but i need to be able to run a C program on Windows without compiling/building it.  How can this be done?  .bat, .exe, if so how..?

C program consist of only one file,, i.e. test.c

Thanks

0
abbas486
Asked:
abbas486
  • 3
  • 3
  • 2
2 Solutions
 
PaulCaswellCommented:
Hi abbas486,

You could probably find a C interpreter but I doubt that is what you are looking for. Could you give us a little more on why you want to do this? We may be able tom come up with some alternatives.

Paul
0
 
abbas486Author Commented:
hi,

i need this because i may need to run this on a computer (Windows) which may not have a C compiler.  Therefore i was wondering if there is any way i can precompile and package it, and just simply run the program by doubleclicking on it ('it' being an icon of some sort).

Thanks
0
 
jhshuklaCommented:
sure. just compile the program and copy the executable (.exe) wherever you want. will work only on windows though. for linux and unix you wil need either (1) a cross compiler OR (2) a compiler on the target machine. but i suspect that you need it only for another windows machine.
btw which compiler are you using? do you know where the compiled file is saved?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PaulCaswellCommented:
You compile the .c program into an .EXE. That then runs on the computer as a program. It doesnt need a compiler to run.

Paul
0
 
abbas486Author Commented:
I am using MS Visual C++ 6.0.  The .exe in the debug folder works to a certain degree.  When I input the last data to the program, the program shuts down without proving the chance to see the tabulated results.
0
 
jhshuklaCommented:
console application? two ways to solve the problem: open command window, navigate to the folder & run it from there. other is to add system("pause") before exiting. the prog will wait until user presses a key.
0
 
abbas486Author Commented:
thanks it works, now who gets the points hmmm...ill get back to this later
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now