[ av@z @ 10.07.2005. 21:05 ] @
Kako ide najobicnija funkcija u C-u za brisanje fajla, probao sam sa remove(); ali nece da mi brise ako fajl ima vise od stotinjak linija? |
[ av@z @ 10.07.2005. 21:05 ] @
[ X Files @ 10.07.2005. 21:12 ] @
Velicina fajla nema nikakve veze sa brisanjem...
Evo ga primer u BCB-u za remove(): Code: #include <stdio.h> int main(void) { char file[80]; /* prompt for file name to delete */ printf("File to delete: "); gets(file); /* delete the file */ if (remove(file) == 0) printf("Removed %s.\n",file); else perror("remove"); return 0; } [ leka @ 15.07.2005. 11:10 ] @
Ako ti ne radi remove() iz STD C biblioteke, onda probaj unlink(): http://man.nu6.org/index.php/man/unlink/2
Pogledaj svoj kod i proveri da li si "uvukao" stdio.h zaglavlje. [ z@re @ 18.07.2005. 22:00 ] @
Code: #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char filename[256], command[5] = "del "; printf("unesite ime filea :"); gets(filename); strcat(command, filename); system(command); return EXIT_SUCCESS; } [ japan @ 19.07.2005. 01:23 ] @
Citat: z@re: Code: #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char filename[256], command[5] = "del "; printf("unesite ime filea :"); gets(filename); strcat(command, filename); system(command); return EXIT_SUCCESS; } $ gcc test.c /tmp/cct2espB.o(.text+0x18): In function `main': : warning: the `gets' function is dangerous and should not be used. nikad, ali nikad ne koristi gets()... prvo sto procita svaki klinac koji se lozi da bude haker je tutorijal o tome kako iskoristiti gets() za buffer overflow... [ z@re @ 20.07.2005. 14:30 ] @
dobro.
onda umisto Code: gets(filename); koristi Code: scanf("%s", &filename); [ the black forest @ 22.07.2005. 02:20 ] @
Citat: japan: nikad, ali nikad ne koristi gets()... prvo sto procita svaki klinac koji se lozi da bude haker je tutorijal o tome kako iskoristiti gets() za buffer overflow... rofl, e ima genijalaca... Sto u svakom topiku gde neko nesto pita, mora da se nadje ovakav genijalac? [ rumpl @ 22.07.2005. 17:59 ] @
Ljudi ma kakav gets ili scanf koristite write!!!
[ leka @ 22.07.2005. 18:43 ] @
Otisli ste od teme - ovde se diskutuje o brisanju fajla koriscenjem nekog C poziva...
2moderator: Da sam na Vasem mestu obrisao bih poslednjih nekoliko tekstova. [ the black forest @ 22.07.2005. 23:59 ] @
Citat: rumpl: Ljudi ma kakav gets ili scanf koristite write!!! Mislio si read, jes majku mu, tu ne moz da ga hakuju=)))))) [ rumpl @ 23.07.2005. 13:15 ] @
A i ja hocu da se pravim pametan pa ispadnem glup...
Reality is an illusion that occurs due to lack of alcohol. ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|