Jump to content

Προγραμματισμός: Δημιουργία φακέλου...


Georgekatz
 Κοινοποίηση

Recommended Posts

Όλοι το ξέρουμε...

Δεξί κλικ > New > Folder

και έτοιμος ο καινούριος φάκελος!

 

Πώς ομώς δημιουργούμε φάκελο μέσα από την C;

Γράψτε και λίγο κώδικα να πάρω μία ιδέα plz...

Time is what keeps everything from happening at once.
Link to comment
Share on other sites

Δεν ειμαι σιγουρος αλλα μηπως εννοεις μεσω DOS?

Αν ναι τοτε οπως εισαι στο C:\md και το directory που θελεις να δημιουργησεις

 

example : C:\md Georgekatz

 

Και αν θελεις να τον διαγραψεις τοte βαζεις το rd.

 

example C:\rd Georgekatz

http://www.myphone.gr/mp1/myphone7.gif

P900/P910i/V3i/K800i/iPhone 2G/C510/Galaxy 3/Galaxy Ace/Galaxy S2/Galaxy S3/LG G2/OpO/Galaxy Alpha/S7 Edge

Link to comment
Share on other sites

#include <stdlib.h>

 

const char *command = "mkdir ./temp";

 

system(command);

 

Afta gia dhmiourgia directory sto unix

 

 

twra sta windows yparxoun etoimes API

secattr SECURITY_ATTRIBUTES;

long retval;

 

secattr.nLength = sizeof(ATTRIBUTES);

secattr.lpSecurityDescriptor = 0;

secattr.bInheritHandle = 1;

 

retval = CreateDirectory("C:\temp\testDir1", secattr);

Link to comment
Share on other sites

Thanks gpou! Αυτό ακριβώς που ήθελα...

Λίγο error free κώδικας βασισμένος στο post του gpou

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

void main(){

SECURITY_ATTRIBUTES *secattr; 
long retval;

if( (secattr = (SECURITY_ATTRIBUTES *)malloc(sizeof( SECURITY_ATTRIBUTES ))) == NULL ){
	perror("malloc");
	exit( EXIT_FAILURE );
} 

secattr->nLength = sizeof( SECURITY_ATTRIBUTES ); 
secattr->lpSecurityDescriptor = 0; 
secattr->bInheritHandle = 1; 

retval = CreateDirectory("C:\Thanks gpou!", secattr);
}

Time is what keeps everything from happening at once.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Επισκέπτης
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Κοινοποίηση

×
×
  • Create New...