Fandom

武装突袭 Wiki

File Commands

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 Share

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

GetCD编辑

see [[File Commands]setcd]

SetCD编辑

_folder=GetCD; // returns fully qualified (P:\etc)
_SetCD(folder);


openStandardIO编辑

   Opens stream for standard input and output. If no standard I/O is assigned, creates console, and redirect I/O into console. Note: Always assign result to variable, and access stream with variable.

Example:

   console=openStandardIO; console<<"Hallo world"

console=nil; close it


openFile ["filename",mode]编辑

  • Returns IOStream

Opens or creates a file specified by filename. Mode contain one of following values:

  • 0 - test existence of file (no open)
  • 1 - open existing file for reading
  • 2 - create new file for writting
  • 3 - open existing file for reading and writting
  • 4 - open (create if not exists) file for reading and writting

Example:

_file=openFile ["some\file\anywhere.ext",0];
if (!isnil("_file")) then {do_something;_file=nil;};

Note: _file will be non nil for mode 0

shellCmd "command"编辑

Retursn: Result (number)

Function waits until command is finished

result is -1 if file not found, or cannot be started, otherwise returns application's exit code

Example:

   _result = shellCmd ("notepad.exe");


shellCmdOpenPipe "command"编辑

Returns IOStream

Creates bi-directional pipe to the new process. Script can use this pipe to send commands to child process and read its results

Example:

_files=shellCmdOpenPipe ("dir /b/a:-d-h/L *.p3d"); list only p3d files in lower case, no hidden stuff
while "!eof _files" do 
{
 _filename= getline _files;
 if (_filename!="") then {[_filename] call something;};
};
_files=nil;


SplitPath "Path"编辑

Returns the Path string into a 4 element array

   [drive,folders,filename,extension]


Example:

   splitPath "C:\test\anywhere\anyFile.txt" , result is ["c:","\test\anywhere","anyFile",".txt"]

this command does not work as nature intended

the drive is force-set to current drive

the folder path is determined by current directory

a lack of preceding slash adds it. any drive specification in the string (such as proxy:) is treated as folder path (part of)

更多维基

随机维基