forked from KolibriOS/kolibrios
- Added 4 functions to libck: getcwd, setcwd, mkdir, rmdir.
- Fixed Makefile for building "libck" under tcc. - Added example to new functions git-svn-id: svn://kolibrios.org@8280 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -11,4 +11,5 @@
|
||||
../tcc clayer/boxlib.c -lck -lbox -o /tmp0/1/boxlib_ex
|
||||
../tcc clayer/libimg.c -lck -limg -o /tmp0/1/libimg_ex
|
||||
../tcc console/console.c -lck -limg -o /tmp0/1/console
|
||||
../tcc dir_example.c -lck -o /tmp0/1/dir_example
|
||||
exit
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#include <dir.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
int main()
|
||||
{
|
||||
char *path=getcwd(NULL, PATH_MAX);
|
||||
printf("Current directory: %s\n", path);
|
||||
setcwd("/sys"); //String must be null terminated!
|
||||
path=getcwd(NULL, PATH_MAX);
|
||||
printf("Move to the directory: %s\n", path);
|
||||
free(path);
|
||||
if(true==mkdir("TEST1")){
|
||||
puts("Test folder created!");
|
||||
return(0);
|
||||
}
|
||||
else{
|
||||
puts("Error creating folder!");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user