C语言函数—fopen

函数名

fnmerge

功 能

建立新文件名

用 法

void fnerge(char *path, char *drive, char *dir);

程序例

#include <string.h> 
#include <stdio.h> 
#include <dir.h> 
  

int main(void) 
{ 
    char s[MAXPATH]; 
    char drive[MAXDRIVE]; 
    char dir[MAXDIR]; 
    char file[MAXFILE]; 
    char ext[MAXEXT]; 

    getcwd(s,MAXPATH);              /* get the current working directory */ 
    strcat(s,"");                  /* append on a trailing  character */ 
    fnsplit(s,drive,dir,file,ext); /* split the string to separate elems */ 
    strcpy(file,"DATA"); 
    strcpy(ext,".TXT"); 
    fnmerge(s,drive,dir,file,ext);   /* merge everything into one string */ 
    puts(s);                                 /* display resulting string */ 

    return 0; 
} 
  
  
  

如果引用本站的原创文章,请注明原文链接:,本站保留追究责任的权利!