LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-30-2005, 01:53 PM   #1
revolutionary_era
LQ Newbie
 
Registered: Sep 2005
Location: Pullman, WA
Distribution: Ubuntu
Posts: 14

Rep: Reputation: 0
Commands in C++ Programs


I was just wondering how to access the terminal commands in a C++ program. Is it possible to rename an entire directory of files to a list of filenames with a similar base. For example:

/Pics
pic1.jpg
picture.jpg
image.jpg
photo9.jpg

can be changed with a program to:

/Pics
img01.jpg
img02.jpg
img03.jpg
img04.jpg

If this is possible from a C++ program, you don't have to give me a solution, but please let me know how to access the bash commands from the program.

Thanks!

-Fred
 
Old 09-30-2005, 02:38 PM   #2
armanox
Member
 
Registered: Sep 2005
Location: Baltimore, MD, USA
Distribution: Fedora, Gentoo, Debian, Slackware, IRIX, OS X
Posts: 192

Rep: Reputation: 32
c++ has a wonderfull function called system()
it works like this:

system("clear");


the command goes inside of the string
so, to rename a something
system("mv item1 item2 ");
 
Old 09-30-2005, 04:06 PM   #3
revolutionary_era
LQ Newbie
 
Registered: Sep 2005
Location: Pullman, WA
Distribution: Ubuntu
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks man!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Commands in Gnome (and common X programs) detly Linux - Software 3 11-16-2005 01:54 AM
cant access normal programs/commands PSIPHON Slackware 6 07-22-2005 07:58 AM
Executing Linux commands in C programs--->please help dennyvm Programming 3 01-15-2004 10:51 AM
programs of commands nitk Linux - Newbie 1 10-24-2003 11:54 PM
compiling commands/programs? ptolbert Linux - Newbie 2 12-21-2001 12:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration