Ĺadny brzuch
sorki za glupie pytanie ale jak sie usuwa pliki w c ?
tylko nie odpowiadajcie system("del plik") - a jezeli tak to jak wprowadzic do tego nawiasu zmienna/sciezke do liku ktory chce usunac:
opcja
cout<<"nazwa pliku";cin>>plik;
system("del plik")
nie dziala bo progam szuka pliku o nazwie plik a nie wartosci podanej.
nie intersuje mnie tez RemoveFile czy tez DeletFile przeciez jakso trzebabylo usuwac pliki w dosie nie?
DeleteFile(C:\\folder\\plik.xxx);
to jest przykłądziki ;)
DeleteFile(C:\\folder\\plik.xxx);
to jest przykłądziki ;)
char adres[64]; cin >> adres; char adreszdel[68]; adreszdel[0] = 'd'; adreszdel[0] = 'e'; adreszdel[0] = 'l'; adreszdel[0] = ' '; for(int i = 0; true; i++) { if(adres[i] == ' ') { adreszdel[i + 4] = 0; break; } adreszdel[i + 4] = adres[i]; } system(adreszdel);
To powinno zadzialac, moze to lipny kod ale powinenes zrozumiec o co chodzi.
#include <stdio.h>
#include <conio.h>
#include <iostream>
using namespace std;
main(){
char adres[64];
cin>>adres;
char adreszdel[68];
adreszdel[0] = 'd';
adreszdel[0] = 'e';
adreszdel[0] = 'l';
adreszdel[0] = ' ';
for(int i = 0; true; i++)
{
if(adres[i] == ' ')
{
adreszdel[i + 4] = 0;
break;
}
adreszdel[i + 4] = adres[i];
}
system(adreszdel);
}
NIE DZIALA:(
#include <iostream>
#include <stdlib.h>
using namespace std ;
int main(int argc, char *argv[])
{
char adres_del [64] ;
sprintf(adres_del, "del %s", argv) ;
system(adres_del) ;
return 0;
}
Na pewno działa, sprawdzałem ;)
pozdrawiam
#include <iostream>
#include <stdlib.h>
using namespace std ;
int main(int argc, char *argv[])
{
char adres_del [64] ;
sprintf(adres_del, "del %s", argv) ;
system(adres_del) ;
return 0;
}
Na pewno działa, sprawdzałem ;)
pozdrawiam
ja napisalem tak:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
char usuwanie[20];
char name[10];
cout<<"napisz nazwe pliku do usuniecia -name.txt\n";
cin>>name;
char kas[7]="del %s";
strcat(kas,name);
cout<<kas;
system(kas);
}
ale tez nie dziala:(
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
char name[10];
cout<<"napisz nazwe pliku do usuniecia -name.txt\n";
cin>>name;
char kas[5]="del ";
strcat(kas,name);
cout<<kas;
system(kas);
}
ok tak jak wyzej dziala:)
zanotowane.pl doc.pisz.pl pdf.pisz.pl zsf.htw.pl
tylko nie odpowiadajcie system("del plik") - a jezeli tak to jak wprowadzic do tego nawiasu zmienna/sciezke do liku ktory chce usunac:
opcja
cout<<"nazwa pliku";cin>>plik;
system("del plik")
nie dziala bo progam szuka pliku o nazwie plik a nie wartosci podanej.
nie intersuje mnie tez RemoveFile czy tez DeletFile przeciez jakso trzebabylo usuwac pliki w dosie nie?
DeleteFile(C:\\folder\\plik.xxx);
to jest przykłądziki ;)
DeleteFile(C:\\folder\\plik.xxx);
to jest przykłądziki ;)

char adres[64]; cin >> adres; char adreszdel[68]; adreszdel[0] = 'd'; adreszdel[0] = 'e'; adreszdel[0] = 'l'; adreszdel[0] = ' '; for(int i = 0; true; i++) { if(adres[i] == ' ') { adreszdel[i + 4] = 0; break; } adreszdel[i + 4] = adres[i]; } system(adreszdel);
To powinno zadzialac, moze to lipny kod ale powinenes zrozumiec o co chodzi.
#include <stdio.h>
#include <conio.h>
#include <iostream>
using namespace std;
main(){
char adres[64];
cin>>adres;
char adreszdel[68];
adreszdel[0] = 'd';
adreszdel[0] = 'e';
adreszdel[0] = 'l';
adreszdel[0] = ' ';
for(int i = 0; true; i++)
{
if(adres[i] == ' ')
{
adreszdel[i + 4] = 0;
break;
}
adreszdel[i + 4] = adres[i];
}
system(adreszdel);
}
NIE DZIALA:(
#include <iostream>
#include <stdlib.h>
using namespace std ;
int main(int argc, char *argv[])
{
char adres_del [64] ;
sprintf(adres_del, "del %s", argv) ;
system(adres_del) ;
return 0;
}
Na pewno działa, sprawdzałem ;)
pozdrawiam
#include <iostream>
#include <stdlib.h>
using namespace std ;
int main(int argc, char *argv[])
{
char adres_del [64] ;
sprintf(adres_del, "del %s", argv) ;
system(adres_del) ;
return 0;
}
Na pewno działa, sprawdzałem ;)
pozdrawiam

ja napisalem tak:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
char usuwanie[20];
char name[10];
cout<<"napisz nazwe pliku do usuniecia -name.txt\n";
cin>>name;
char kas[7]="del %s";
strcat(kas,name);
cout<<kas;
system(kas);
}
ale tez nie dziala:(
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
char name[10];
cout<<"napisz nazwe pliku do usuniecia -name.txt\n";
cin>>name;
char kas[5]="del ";
strcat(kas,name);
cout<<kas;
system(kas);
}
ok tak jak wyzej dziala:)