473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to solve this problem

In c i have to create new directory , i have to add the files to the directory and
we have to add this new directory to another old directory..please suggest any solution to this problem...
Nov 29 '06 #1
6 1506
Hmm,

R u Expecting a solution with GUI for this. I dont get your question. Dont you think it can be easily done by using system() function in C. We can run all dos commands using it.

Regards,
ShaggY@FtF
Nov 29 '06 #2
horace1
1,510 Expert 1GB
In c i have to create new directory , i have to add the files to the directory and
we have to add this new directory to another old directory..please suggest any solution to this problem...
if you are using the GNU C/C++ compiler (e.g. under Linux or with Cygwin or DEV-C++ under Windows) you can use the GNU mkdir() function, see
http://www.delorie.com/gnu/docs/glibc/libc_282.html

a simple bit of code would be
Expand|Select|Wrap|Line Numbers
  1.      int result;
  2.      if((result=mkdir("testdir", 0x700))==0) printf("mkdir OK");
  3.      else                                    perror("mkdir fail");
  4.  
Nov 29 '06 #3
Hmm,

R u Expecting a solution with GUI for this. I dont get your question. Dont you think it can be easily done by using system() function in C. We can run all dos commands using it.

Regards,
ShaggY@FtF
hi man, i want to write code in c man..not GUI or running DOS commands..
Nov 30 '06 #4
hi man, i want to write code in c man..not GUI or running DOS commands..

Hmm,

if you look at my post. I said "using system function in C "


Please find below what a system command can do..

Read the command you want to run in to a string variable and then pass the variable to system function....

#include <stdlib.h>
int system( const char *command );

The system() function runs the given command as a system call. The return value is usually zero if the command executed without errors. If command is NULL, system() will test to see if there is a command interpreter available. Non-zero will be returned if there is a command interpreter available, zero if not.



eg: system("MKDIR shaggy");

will create a directory with name shaggy. similarly you can use any command which can run on dos. use this in your code it will make things simple.. :)

Regards,
ShaggY@FtF.
Nov 30 '06 #5
DeMan
1,806 1GB
perhaps I'm wrong, but I think you miss the point in the replies to your post...both of them have given solutions IN c which will work. svsandeep suggests
Dont you think it can be easily done by using system() function in C
. What he means is you use system() to call a command line function, that is you can create directories THROUGH C by calling the command line.
mkdir() as horace1 suggests will make a directory (irrespective of GUI or not) and either way is still called through c.

Maybe I missed the point, could you rephrase the question?
Nov 30 '06 #6
perhaps I'm wrong, but I think you miss the point in the replies to your post...both of them have given solutions IN c which will work. svsandeep suggests . What he means is you use system() to call a command line function, that is you can create directories THROUGH C by calling the command line.
mkdir() as horace1 suggests will make a directory (irrespective of GUI or not) and either way is still called through c.

Maybe I missed the point, could you rephrase the question?
ok thanks for all of u..i got some points from u
Nov 30 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: BVM | last post by:
Hi, All: I have this error. It seems execution time is too long. Actually the execution time is about 30 seconds(I tested in Query analyzer). How do I solve this problem? ...
3
by: Alex | last post by:
Hi, I have a problem involving some design issue. I have two unrelated (that is, they do not derive from the same base) classes: ClassA ClassB Both have a quite similar interface, so they can...
7
by: Shapper | last post by:
Hello, I have an ASP:ImageButton where I want to call a function and pass a string: OnClick="Change_Photo("John")" I am having problems with "". I tried
6
by: Federico | last post by:
Hi, this is what I can do: - Create new solutions using VS.Net ASP.Net - Save the solutions, build the solution, view in browser with the solution still open. But, once I close the solution, I...
0
by: Jitesh | last post by:
I am facing a problem in webservice, I want to know what will be the exact procedure to solve the problem............. What I want to do............ I have a table named order in SQL Server....
27
by: John Salerno | last post by:
Ok, here's a problem I've sort of assigned to myself for fun, but it's turning out to be quite a pain to wrap my mind around. It's from a puzzle game. It will help if you look at this image: ...
8
by: vj | last post by:
Hi all, I want to solve the two equations u*tan(u)=w and u^2 + w^2=V^2, where V is a known constant, and u and w are the two unknowns to be determined. Please can someone suggest me how to...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
17
by: Michael Reichenbach | last post by:
Here is the example code. int main(int argc, char *argv) { string Result; WIN32_FIND_DATA daten; HANDLE h = FindFirstFile(TEXT("c://test"), &daten); system("PAUSE"); return EXIT_SUCCESS; }
2
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.