Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 31st, 2007, 11:30 AM   #1
cueballr
Newbie
 
Join Date: Oct 2007
Posts: 19
Rep Power: 0 cueballr is on a distinguished road
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
cueballr is offline   Reply With Quote
Old Oct 31st, 2007, 12:05 PM   #2
cueballr
Newbie
 
Join Date: Oct 2007
Posts: 19
Rep Power: 0 cueballr is on a distinguished road
Re: c++ code to read from batch file

never mind i got it..
cueballr is offline   Reply With Quote
Old Oct 31st, 2007, 12:07 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Nov 1st, 2007, 5:43 AM   #4
cueballr
Newbie
 
Join Date: Oct 2007
Posts: 19
Rep Power: 0 cueballr is on a distinguished road
Re: c++ code to read from batch file

haha..fair enough...okay...could you please tell me how to convert the batch file code to c++ code..if its not to much work, one more question, is it a single command to convert the whole batch file or does it have to be line by line?

thanks in advance.

cueballr =]
cueballr is offline   Reply With Quote
Old Nov 1st, 2007, 7:04 AM   #5
hollystyles
Omlette du fromage
 
hollystyles's Avatar
 
Join Date: Oct 2007
Posts: 29
Rep Power: 0 hollystyles is on a distinguished road
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.
hollystyles is offline   Reply With Quote
Old Nov 1st, 2007, 7:28 AM   #6
cueballr
Newbie
 
Join Date: Oct 2007
Posts: 19
Rep Power: 0 cueballr is on a distinguished road
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. =]
cueballr is offline   Reply With Quote
Old Nov 1st, 2007, 9:55 AM   #7
hollystyles
Omlette du fromage
 
hollystyles's Avatar
 
Join Date: Oct 2007
Posts: 29
Rep Power: 0 hollystyles is on a distinguished road
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.
hollystyles is offline   Reply With Quote
Old Nov 1st, 2007, 10:47 AM   #8
cueballr
Newbie
 
Join Date: Oct 2007
Posts: 19
Rep Power: 0 cueballr is on a distinguished road
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
cueballr is offline   Reply With Quote
Old Nov 1st, 2007, 11:03 AM   #9
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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".
Sane is offline   Reply With Quote
Old Nov 1st, 2007, 1:51 PM   #10
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:25 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC