[C] 建立新文件名 →→→→→进入此内容的聊天室

来自 , 2020-10-18, 写在 C, 查看 114 次.
URL http://www.code666.cn/view/487d4c6a
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <dir.h>
  4.  
  5.  
  6. int main ( void )
  7. {
  8.         char s[MAXPATH];
  9.         char drive[MAXDRIVE];
  10.         char dir[MAXDIR];
  11.         char file[MAXFILE];
  12.         char ext[MAXEXT];
  13.  
  14.         getcwd ( s,MAXPATH );           /* get the current working directory */
  15.         strcat ( s,"\\" );               /* append on a trailing \ character */
  16.         fnsplit ( s,drive,dir,file,ext ); /* split the string to separate elems */
  17.         strcpy ( file,"DATA" );
  18.         strcpy ( ext,".TXT" );
  19.         fnmerge ( s,drive,dir,file,ext );   /* merge everything into one string */
  20.         puts ( s );                              /* display resulting string */
  21.  
  22.         return 0;
  23. }
  24.  

回复 "建立新文件名"

这儿你可以回复上面这条便签

captcha