CreateFile

来源:互联网 发布:thinkphp源码分析视频 编辑:程序博客网 时间:2024/05/08 06:15

<!-- /* Font Definitions */ @font-face{font-family:"MS 明朝";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-alt:"MS Mincho";mso-font-charset:128;mso-generic-font-family:roman;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:SimSun;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:宋体;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:Century;panose-1:2 4 6 3 5 7 5 2 3 3;mso-font-alt:"Times New Roman";mso-font-charset:0;mso-generic-font-family:roman;mso-font-format:other;mso-font-pitch:variable;mso-font-signature:3 0 0 0 1 0;}@font-face{font-family:"/@MS 明朝";panose-1:2 2 6 9 4 2 5 8 3 4;mso-font-charset:128;mso-generic-font-family:roman;mso-font-pitch:fixed;mso-font-signature:-1610612033 1757936891 16 0 131231 0;}@font-face{font-family:"/@SimSun";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0mm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:Century;mso-fareast-font-family:"MS 明朝";mso-bidi-font-family:"Times New Roman";mso-font-kerning:1.0pt;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:595.3pt 841.9pt;margin:99.25pt 30.0mm 30.0mm 30.0mm;mso-header-margin:42.55pt;mso-footer-margin:49.6pt;mso-paper-source:0;layout-grid:18.0pt;}div.Section1{page:Section1;}-->

1取当前时间,使用GetLocalTime函数,然后按照你的需要理成对应的字符串
2
、使用CreateDirectory建文件入完整的文件路径,比如你当前文件夹为C:/A,你要建文件B则传C:/A/B/
3
建文件有多方法,比如fopenCreateFile等。

 

使用GetFileOpenName
li_rtn = GetFileOpenName("Select File", &
  docpath, docname, "PDF", &
  + "PDF Files (*.PDF),*.PDF," &
  + "Doc Files (*.DOC),*.DOC," &
  + "All Files (*.*), *.*", &
  "d:/", 18)
IF li_rtn < 1 THEN return
ls_filename = string(docpath)

 

The following example displays a SelectFile dialog box that allows multiple selection. The file types are TXT, DOC,and all files, and the initial directory is C:/Program Files/Sybase. The optionflag 18 specifies that the Explorer-style dialog box is used (2^1 = 2), and theRead Only check box is hidden (2^4 = 16). The selected filenames are displayedin a MultiLineEdit control.

string docpath, docname[]

 integer i, li_cnt, li_rtn, li_filenum

 

 li_rtn = GetFileOpenName("Select File", &

  docpath, docname[], "DOC", &

  + "Text Files (*.TXT),*.TXT," &

  + "Doc Files (*.DOC),*.DOC," &

  + "All Files (*.*), *.*", &

  "C:/Program Files/Sybase", 18)

 

 IF li_rtn < 1 THEN return

 li_cnt = Upperbound(docname)

 

 for i=1 to li_cnt

  mle_selected.text +=

  string(docpath)+"/"+(string(docname[i]))+"~r~n"

 next

In the following example, the dialog box has the title Open and displays textfiles, batch files, and INI files in the Files of Type drop-down list. Theinitial directory is d:/temp. The option flag 512 specifies that the old-styledialog box is used and the Network button is hidden (2^9 = 512). 

// instance variables

 // string is_filename, is_fullname

 int li_fileid

 

 if GetFileOpenName ("Open", is_fullname, is_filename, &

  "txt", "Text Files (*.txt),*.txt,INI Files " &

  + "(*.ini), *.ini,Batch Files (*.bat),*.bat", &

  "d:/temp", 512) < 1 then return

 

 li_fileid = FileOpen (is_fullname, StreamMode!)

 FileRead (li_fileid, mle_notepad.text)

 FileClose (li_fileid)