You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
727 B
Plaintext
31 lines
727 B
Plaintext
15 years ago
|
#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");
|