ex-file-copy.ulp

来自「老外的PCB设计软件,是免费的.可以上网更新.」· ULP 代码 · 共 31 行

ULP
31
字号
#usage "<b>Example: Copy a file</b>\n"
       "<p>"
       "<author>Author: support@cadsoft.de</author>"

// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED

string fileName;
string test = "";
int Result = 0;
int nBytes = 0;
int start = 0;
char c[];

fileName = dlgFileOpen("Select a file", "*.*");

nBytes = fileread(c, fileName);

sprintf(test, "%d = &%x", nBytes, nBytes);
dlgMessageBox("Length of File = " + test);

dlgMessageBox("Write " + fileName + "?");
fileName += ".copy";
output(fileName, "wb") {
  for (int z = 0; z < nBytes; z++) {
    printf("%c", c[z]);
    Result = z+1;
    }
  }
sprintf(test, "%d = $%x", Result, Result);
dlgMessageBox("Length of File = " + test, "OK");

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?