home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 December / Chip_2003-12_cd2.bin / oo / download / f_0019 / sbasic.jar / text / sbasic / common / 03020411.xml < prev    next >
Extensible Markup Language  |  2003-01-16  |  5KB  |  71 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>P┼Ö├¡kaz MkDir [Runtime]</title><meta name="filename" content="text/sbasic/common/03020411"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         p.P2{
  7.                 }
  8.         span.T1{
  9.                 font-weight:bold;}
  10.         </style></head><body>
  11.   
  12.   
  13.   <help:to-be-embedded Eid="mkdir" xmlns:help="http://openoffice.org/2000/help">
  14.   <p class="Head1"><help:link Id="66444">P┼Ö├¡kaz MkDir [Runtime]</help:link></p>
  15.   <p class="Paragraph">Vytvo┼Ö├¡ na datov├⌐m m├⌐diu nov├╜ adres├í┼Ö.</p>
  16.   </help:to-be-embedded>
  17.   <p class="Paragraph"><span class="T1">Syntaxe</span>:</p>
  18.   <p class="Paragraph">MkDir Text typu String <help:key-word value="MkDir" tag="kw66444_1" xmlns:help="http://openoffice.org/2000/help"/></p>
  19.   <p class="Paragraph"><span class="T1">Parametr</span>:</p>
  20.   <p class="Paragraph">Text: Libovoln├╜ ┼Öet─¢zec ur─ìuj├¡c├¡ n├ízev adres├í┼Öe, kter├╜ m├í b├╜t vytvo┼Öen, a cestu k n─¢mu. Jako parametr lze tak├⌐ pou┼╛├¡t <help:link Id="66636" Eid="urllocal" xmlns:help="http://openoffice.org/2000/help">adresu URL</help:link>.</p>
  21.   <p class="Paragraph">Nen├¡-li ur─ìena cesta, bude zadan├╜ adres├í┼Ö vytvo┼Öen v aktu├íln├¡m adres├í┼Öi.</p>
  22.   <p class="P2">P┼Ö├¡klad:</p>
  23.   <p class="PropText">Sub ExampleFileIO</p>
  24.   <p class="PropText">' Example for functions of the file organisation</p>
  25.   <p class="PropText">Const sFile1 as String = "file://c|/autoexec.bat"</p>
  26.   <p class="PropText">Const sDir1 as String = "file://c|/Temp"</p>
  27.   <p class="PropText">Const sSubDir1 as String ="Test"</p>
  28.   <p class="PropText">Const sFile2 as String = "Copied.tmp"</p>
  29.   <p class="PropText">Const sFile3 as String = "Renamed.tmp"</p>
  30.   <p class="PropText">Dim sFile as String</p>
  31.   <p class="PropText">sFile = sDir1 + "/" + sSubDir1</p>
  32.   <p class="PropText">ChDir( sDir1 )</p>
  33.   <p class="PropText">If Dir(sSubDir1,16)="" then ' Does the directory exist ?</p>
  34.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>MkDir sSubDir1</p>
  35.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>MsgBox sFile,0,"Create directory"</p>
  36.   <p class="PropText">End If</p>
  37.   <p class="PropText"/>
  38.   <p class="PropText">sFile = sFile + "/" + sFile2</p>
  39.   <p class="PropText">FileCopy sFile1 , sFile</p>
  40.   <p class="PropText">MsgBox fSysURL(CurDir()),0,"Current directory"</p>
  41.   <p class="PropText">MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Creation time"</p>
  42.   <p class="PropText">MsgBox <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sFile & Chr(13)& FileLen( sFile ),0,"File length"</p>
  43.   <p class="PropText">MsgBox <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sFile & Chr(13)& GetAttr( sFile ),0,"File attributes"</p>
  44.   <p class="PropText">Name sFile as sDir1 + "/" + sSubDir1 + "/" + sFile3</p>
  45.   <p class="PropText">' Rename in the same directory</p>
  46.   <p class="PropText"/>
  47.   <p class="PropText">sFile = <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sDir1 + "/" + sSubDir1 + "/" + sFile3</p>
  48.   <p class="PropText">SetAttr( sFile, 0 ) 'Delete all attributes</p>
  49.   <p class="PropText">MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"New file attributes"</p>
  50.   <p class="PropText">Kill sFile</p>
  51.   <p class="PropText">RmDir sDir1 + "/" + <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>sSubDir1</p>
  52.   <p class="PropText">end sub</p>
  53.   <p class="PropText"/>
  54.   <p class="PropText">' Converts a system path in URL</p>
  55.   <p class="PropText">Function fSysURL( fSysFp as String ) as String</p>
  56.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Dim iPos <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>As String</p>
  57.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = 1</p>
  58.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = Instr(iPos,fSysFp, getPathSeparator())</p>
  59.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>do while iPos > 0</p>
  60.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>mid( fSysFp, iPos , 1,"/")</p>
  61.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = Instr(iPos+1,fSysFp, getPathSeparator())<text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  62.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>loop</p>
  63.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>' the colon with DOS</p>
  64.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iPos = Instr(1,fSysFp,":")<text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  65.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>if iPos > 0 then mid( fSysFp, iPos , 1,"|")</p>
  66.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>fSysURL = "file://" & fSysFp</p>
  67.   <p class="PropText">End Function</p>
  68.   <p class="PropText"/>
  69.   <p class="PropText"/>
  70.  </body></html>
  71.