unlink是一種函式名稱。
基本介紹
- 外文名:unlink
- 函式原型:int unlink()
- 所屬庫:const char * pathname
- 相關函式: link,rename
函式簡介
#ifdef WIN32#include <windows.h>#else#include <unistd.h>#endif
程式示例
#include<unistd.h>#include<stdio.h>int main(void){ FILE *fp = fopen("junk.jnk","w"); int status; fprintf(fp,"junk"); status = access("junk.jnk",0); if (status == 0) printf("File exists\n"); else printf("File doesn't exist\n"); fclose(fp); unlink("junk.jnk"); status = access("junk.jnk",0); if (status == 0) printf("File exists\n"); else printf("File doesn't exist\n"); return 0;}