Код для скрытия папки или файла с помощью программирования на языке Си?
Я не могу скрыть файлы или папки с помощью #Include&ЛТ;Ио.ч&ГТ;,#включать<ОСН.ч&ГТ; с помощью
_chmod(FN,1,FA_SYSTEM | FA_HIDDEN | FA_RDONLY);
Что я уже пробовал:
#include<stdio.h> #include<conio.h> #include<dos.h> #include<io.h> void main() { int i,test; //test for condition in c programming char ch,FN[20]; //fn mean file name-ch mean to choice a number in switch char s[]={"#FILE/FOLDER PROTECTION SOFTWARE !"}; clrscr(); gotoxy(14,5); textcolor(2); cprintf("_______________________________________________"); gotoxy(14,6); cprintf("_______________________________________________"); gotoxy(14,10); cprintf("_______________________________________________"); gotoxy(18,8); textcolor(10); for(i=0;s[i]!='\0';i++) //to show the header which is declear in char { _setcursortype(1); cprintf("%c",s[i]); delay(50); sound(1500); delay(50); nosound(); } textcolor(2); // for a text color in c programming gotoxy(22,12); cprintf("1 :HIDE A FILE /FOLDER "); gotoxy(22,14); cprintf("2 :SHOW A FILE /FOLDER "); gotoxy(22,16); cprintf("3 :HELP "); gotoxy(10,24); cprintf("Designed & Developed At Nepha6ker.blogspot.com Copyright @ 2019 "); gotoxy(16,18); cprintf(" ENTER YOUR CHOICE :->> "); ch=getch(); //when the user press esc than it exit the program if(ch==27) exit(1); switch(ch) { case '1':clrscr(); gotoxy(15,6); textcolor(2); cprintf("______________________________________________________"); gotoxy(15,7); cprintf("______________________________________________________"); gotoxy(15,12); cprintf("______________________________________________________"); gotoxy(17,9); cprintf("ENTER THE FILE / FOLDER NAME WITH PATH !!"); gotoxy(17,11); cprintf("$ : "); fflush(stdin);//to clear all the screen which has run when started gets(FN); test=test=_chmod(FN,1,FA_SYSTEM || FA_HIDDEN || FA_RDONLY);//chmod is command to hide the folder or file if(test==-1) { clrscr(); gotoxy(19,9); sound(1000); delay(200); cprintf("Unable to hide file / folder ! "); nosound(); } else { clrscr(); gotoxy(19,9); cprintf("Operation executed successfully !"); nosound(); } break; }
геч();
}
Richard MacCutchan
Я думаю, что вам нужно обновить свое Программирование до современных стандартов. Использование основных функций dos устарело много лет назад.