hello friends this code for delete a file,when i was execute it i got o/p successbut the file was not deleted from my HDD.

#include<dos.h>
#include<conio.h>
#include<stdio.h>

main()
{
clrscr();
union REGS i,o;
char far *fname[67];
puts("enter" );
gets("fname");
i.h.ah=0x41;
i.x.ax=(int)fname;
printf("%d",i.x.ax) ;
intdos(&i,&o);
if(o.x.cflag==0)
printf("success") ;
else
printf("attempt failed");
getch();
};

Recommended Answers

All 3 Replies

After 8 posts, the community expects you to know how to use code tags. Click here

commented: Well said! +25

hello friends this code for delete a file,when i was execute it i got o/p successbut the file was not deleted from my HDD.

Perhaps you should start a new thread then

In order to delete a file you can use the function

remove("filename");

instead of writing the whole program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.