The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
create Virtual directories on Webserver vr76413 SUN Solaris 0 06-28-2007 12:24 PM
Create Folder in Multiple Directories Stud33 Shell Programming and Scripting 15 07-20-2006 03:44 PM
How to create a new unix user in through a c program naren_chella High Level Programming 5 03-03-2006 12:39 AM
How to create directories abishekmag UNIX for Dummies Questions & Answers 3 03-21-2005 01:34 PM
How do I create & Maintain directories kimjones142001 UNIX for Dummies Questions & Answers 4 09-10-2001 05:40 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-13-2005
aloha_boi aloha_boi is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 2
Using a C program to create directories in UNIX

Aloha,

I'm attempting to use a C program to create directories and then use a system call to have another program write .dat files into that directory. I understand that I could use the "system("mkdir directory_name")" function however, I would like my program to create a new directory each time the program loops by incrementing an integer contained in the file name each loop. Here are some example directory names: A1, A2, A3, A4, A5...

I know that this isn't the proper use of the system function, but below is some code that might better illustrate what im trying to do.

main()
{
int i;
for(i=0;i<5;i++)
system("mkdir A%d",i);
}

I also don't mind using a string of characters in an array that I would modify each time I pass through the loop and use as the directory's name.

Does anyone know of a simple way to have a C program create unique directories each time it passes through a loop, by incrementing an integer contained in the file name?

Mahalo,
Windell
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:23 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0