LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 02: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, 03: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, 05: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 02:54 AM
cant access normal programs/commands PSIPHON Slackware 6 07-22-2005 08:58 AM
Executing Linux commands in C programs--->please help dennyvm Programming 3 01-15-2004 11:51 AM
programs of commands nitk Linux - Newbie 1 10-25-2003 12:54 AM
compiling commands/programs? ptolbert Linux - Newbie 2 12-21-2001 01:09 PM


All times are GMT -5. The time now is 02:45 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration