![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2007
Posts: 19
Rep Power: 0
![]() |
c++ code to read from batch file
Could someone tell me the code to run a batch file through a c++ program please?thanks in advance cueballr ![]() |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Oct 2007
Posts: 19
Rep Power: 0
![]() |
Re: c++ code to read from batch file
never mind i got it..
![]() |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: c++ code to read from batch file
Well, a batch file is just text. You don't bother to tell us what you want to do. It could be as simple as printing out the batch file, or executing the batch file, or it could be as complex as attempting to convert the batch file to an equivalent C++ program. My crystal is in the shop for "ball" joints, so I'm not able to read your mind right this minute.
Let me suggest that you read the "How to Post a Question" thread that is stuck at the top of this forum. If you haven't read the rules, please do that, too. There's a link there to Eric Raymond's "Smart Questions." Recommended reading. Welcome to the community.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Oct 2007
Posts: 19
Rep Power: 0
![]() |
Re: c++ code to read from batch file
![]() thanks in advance. cueballr =] |
|
|
|
|
|
#5 |
|
Omlette du fromage
Join Date: Oct 2007
Posts: 29
Rep Power: 0
![]() |
Re: c++ code to read from batch file
Ok you want to convert platform dependant shell commands in a batch file (which could be a linux shell script or windows DOS .bat file blah blah... these are all batch files) into C++ Source code in like one command ??? I doubt that exists very much.
Or do you want to compile a batch file into an executable? I googled Batch File C++ converter translator and compiler. There were various hits. One that kept coming up was Quick Batch Compiler which looked interesting. I'll let you decide. |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Oct 2007
Posts: 19
Rep Power: 0
![]() |
Re: c++ code to read from batch file
Im talking bout a dos .bat file, not a linux one, and i have tried the quick batch file compiler before you pointed it out to me, it worked perfectly, but it is not what i require, i want to convert the batch codes to equivalent c++ codes, and be able to view them just for my knowlegde...was wondering if anyone could help me with that..
![]() thanks anyway ![]() cueballr. =] |
|
|
|
|
|
#7 |
|
Omlette du fromage
Join Date: Oct 2007
Posts: 29
Rep Power: 0
![]() |
Re: c++ code to read from batch file
What knowledge are you trying to glean ??
Do you mean you want to disassemble the batch commands to see how they actually work? IMHO that's *hardest* way to learn. |
|
|
|
|
|
#8 |
|
Newbie
Join Date: Oct 2007
Posts: 19
Rep Power: 0
![]() |
Re: c++ code to read from batch file
...No... i just want the c++ equivalent of batch code...im sure that there is a way of determining that![]() |
|
|
|
|
|
#9 |
|
Programming Guru
![]() |
Re: c++ code to read from batch file
Stop giving him a hard time, I'm pretty sure this is all he wants to know: The function "system" executes a windows batch command in C/C++.
myBatch.bat echo "Hello World!" myApp.cpp int main() {
system("echo \"Hello World!\"");
return 0;
}Note: The "\" is an escape character. It's used before each a quotation mark around "Hello World!" so that C++ does not think those quotations are closing the quotation that started before "echo". |
|
|
|
|
|
#10 |
|
Programming Guru
![]() ![]() ![]() |
Re: c++ code to read from batch file
May want to include the conio.h header file when using the system() function.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem processing file into a char array | csrocker101 | C++ | 1 | May 8th, 2007 11:50 PM |
| Tailing a file? | titaniumdecoy | Python | 4 | Jul 18th, 2006 1:42 PM |
| Read hard disk NTFS file system. | hvcong | C++ | 6 | May 12th, 2006 10:39 AM |
| Batch file - automate process | skguha | Bash / Shell Scripting | 2 | Oct 13th, 2005 10:59 AM |
| Batch File Help | Nonamer64 | Other Programming Languages | 3 | Sep 10th, 2005 5:56 PM |