Jump to content
Forumu Destekleyenlere Katılın ×
Paticik Forumları
2000 lerden beri faal olan, çok şukela bir paylaşım platformuyuz. Hoşgeldiniz.

Why Does It Feels So Good?


Öne çıkan mesajlar

Mesaj tarihi:
#include
#include
#include
#include
#include


#define B_SIZE 1024

typedef struct nameNODE NNODE;
typedef struct bnode BNODE;
typedef struct FILES files;
typedef struct directory dir;
typedef struct system SYSTEM;

struct nameNODE
{
char filename[32];
FILE *block;
files *start;
struct nameNODE *next;
struct nameNODE *prev;
};

struct bnode
{
FILE *block;
int bitmap;
struct bnode *next;
struct bnode *prev;
};

struct FILES
{
char file_name[32];
char extention[3];
long file_size;
time_t create;
time_t last_access;
int total_block_number;
BNODE *start;
};

struct directory
{
char directory_name[32];
long number_of_files;
time_t create;
/*char sub_dir_filename[3][32];*/
NNODE *names;
struct directory *up;
struct directory *down;
struct directory *next;
struct directory *prev;
};


dir* Add_NNODE(dir *ToAdd, char name[32],FILE *block,files *new)
{
NNODE *temp,*temp2=NULL;
temp=(NNODE*)malloc(sizeof(NNODE));
strcpy(temp->filename,name);
temp->block=block;
temp->start=new;
temp->next=NULL;
if(ToAdd->names!=NULL)
{
for(temp2=ToAdd->names;temp2->next!=NULL;temp2=temp2->next);
temp2->next=temp;
temp->prev=temp2;
}
else
{
ToAdd->names=temp;
temp->prev=NULL;
}
return ToAdd;
}


dir* Add_Sub_Dir(dir *new_sub, dir *upper_dir)
{
dir *temp;
if(upper_dir->down==NULL)
{
upper_dir->down=new_sub;
new_sub->up=upper_dir;
return upper_dir;
}

else
{
for(temp=upper_dir->down;temp->next!=NULL;temp=temp->next);

temp->next=new_sub;
new_sub->prev=temp;
new_sub->next=NULL;
new_sub->up=upper_dir;
return upper_dir;
}
}


files* Add_to_file_BNODE(files *ToAdd,FILE *BlockAdress,int bitmap)
{
BNODE *temp,*temp2=NULL;
temp=(BNODE*)malloc(sizeof(BNODE));
temp->block=BlockAdress;
temp->bitmap=bitmap;
temp->next=NULL;
temp->prev=NULL;
if(ToAdd->start!=NULL)
{
for(temp2=ToAdd->start;temp2->next!=NULL;temp2=temp2->next);
temp2->next=temp;
temp->prev=temp2;
}
else
{
ToAdd->start=temp;
temp->prev=NULL;
}

return ToAdd;

}

struct system
{
time_t create_time;
long folder;
dir ROOT; //ilk ‡alŸma zamann alcak sistemden, a‡lan her klas”r
};// rootun altnda, root'un dir.name GEO olacak


void text(files *temp,int Bitmap[],FILE *hdd) //EL€iN DOLDURSUN BUNU
{
int x=1,y=1,i=0,j=0,p=0;
char a;
char string[1024],filename[32];
FILE *block;
for(i=0;i<1024;i++)
string[i]='';
i=0;
clrscr(); //esc 27, backspace 8, enter 13
//file=fopen(filename,"w");
clrscr();
printf("============================= GEO File Editor =============================n");
flushall();
while((a=getch())!=27)
{

if(a==13)
{
x=1;
y++;
string[i]='n';
i++;
}
if(a==8)
{
if(x==1)
{
if(y!=1)
{
y--;
x=1;
for(j=i-2;string[j]!='';j--)
x++;


}
if(y==1)
{
x=i-1;
}
}
else if(x>1)
x--;
if(i!=0)
i--;
string[i]='';
}
if(a!=8 && a!=13)
{
printf("%c",a);
string[i]=a;
i++;
x++;
if(x>81)
{
x=1;
y++;
}
}
clrscr();
printf("============================= GEO File Editor =============================n");
printf("%s",string);

if(i>=1025 && temp->start->next==NULL)
{

fwrite(&string,B_SIZE*sizeof(char),1,temp->start->block);
i=0;
string[i]='';
}
else if(i>=1025)
{
for(p=1;Bitmap[p]!=0;p++); //total block number
fseek(hdd,p*B_SIZE*sizeof(char),SEEK_SET);
block=hdd;
temp=Add_to_file_BNODE(temp,block,p);
fwrite(&string,sizeof(string),1,block);
i=0;
string[i]='';
}
}

if(i<=1025 && temp->start->next==NULL)
{

fwrite(&string,B_SIZE*sizeof(char),1,temp->start->block);
i=0;
string[i]='';
}
else if(i<=1025)
{
for(p=1;Bitmap[p]!=0;p++); //total block number
fseek(hdd,p*B_SIZE*sizeof(char),SEEK_SET);
block=hdd;
temp=Add_to_file_BNODE(temp,block,p);
fwrite(&string,sizeof(string),1,block);
i=0;
string[i]='';
}

clrscr();
gotoxy(26,10);
printf("Thank You For Using EDITOR!!!");
gotoxy(30,12);
printf("Press Any Key To Exit");
getch();


}

void PrintNodesF(files FTemp)
{

BNODE *temp;

for(temp=FTemp.start;temp!=NULL;temp=temp->next)
printf("%p-->" ,temp->block);

printf("n");
getch();

}

void PrintNodesD(dir DTemp)
{


NNODE *temp;
//BNODE *temp2;
for(temp=DTemp.names;temp!=NULL;temp=temp->next)
printf("%p(%s)-->" ,temp->block,temp->filename);

printf("n");

//for(temp2=DTemp.starts;temp2!=NULL;temp2=temp2->next)
//printf("%p-->" ,temp2->block);

getch();
}

/*Init(FILE *hdd)
{

}*/


/*--------------------------------------SYSTEM COMMANDS------------------------------------*/
dir* cd(char name[32],dir *current)
{
dir *temp=NULL;
if(!strcmp("up",name))
{
/*te
Mesaj tarihi:
It doesn't feel good at all...[hline]Trust in my self-righteous suicide
I cry, when angels deserve to die!


Benim la, Phann!

Hatırlar mısın bir aralar OSI'de etrafa para saçan Wacky diye onurlu bi mage vardı... Verin lan paraları geri!
Mesaj tarihi:
saat sabahın 4 ü son uğraştığın initial value problemini çözdükten sonra compile ediyosun ve işte...

bu kadar şeyi yazdıktan sonra sorunsuz çalıştığını görmek hakikaten süper bi duygu.[hline]And Ra'd glorifies and praises Him,
and so do the angels because of His Awe.
Mesaj tarihi:
ahah ben dün gece iki saat uyudum 15 saat aralıksız makine basındaydım..
CS Projesi icin bir kasmısım var ya :)
Yalnız SQL canıma okudu walla, ne hatalar verdi akıllara zarar :)
Ama sonunda halloldu :)
Mesaj tarihi:
abi yukardaki code yeni bi file system'ın code'u.içinde ufak bi text editor ve yanında bi file manager var.

ama daha çoook yapılacak işi var.[hline]And Ra'd glorifies and praises Him,
and so do the angels because of His Awe.
×
×
  • Yeni Oluştur...