My programs issues

pascal111 judas.the.messiah.111 at
Fri Aug 12 02:05:46 UTC 2022

This is a program for duplicating files, I made some changes on 
it, and liked to share it may that I get a new advice on it:


module main;

// D programming language

import std.stdio;
import std.string;
import std.algorithm;
import dcollect;

int main(string[] args)

string s;
//char[] f;
string f1, f2, f3;

for(size_t i=0; args[1].strmid(i, 1)!="."; i++)
        f1~=args[1].strmid(i, 1);

for(size_t i=args[1].length-1; args[1].strmid(i, 1)!="."; i--)
        f2~=args[1].strmid(i, 1);

f3=f1~" (DUPLICATED)."~f2.strreverse;

/*write("Enter file name and path: ");

File inputFile = File(args[1], "r");
File outputFile = File(f3, "w");

enum bufferSize = 8194;
inputFile.byChunk(bufferSize)	// read input in blocks of 8194 
        .copy(outputFile.lockingBinaryWriter); // copy each block 
into output file


catch(Exception err){
stderr.writefln!"Warning! %s"(err.msg);
return 1;

return 0;


More information about the Digitalmars-d-learn mailing list