Innov-AI
    Documentation | MentDB Weak Server
Show MQL samples

  • To show MQL samples
  • ############################################################;
    # Copy a local file to another local file (in binary mode) #;
    ############################################################;
    
    #Initialization;
    -> "[source]" "/Users/jimmitry/Desktop/test.jpg";
    -> "[destination]" "/Users/jimmitry/Desktop/copy.jpg";
    -> "[nb_bytes]" 204800;
    
    try {
    
        #Open a reader;
        file reader_open "r1" [source] BINARY null;
        file writer_open "w1" [destination] true BINARY null;
    
        #Parse the file;
        while (is not null (-> "[bytes]" (file reader_get_bytes "r1" [nb_bytes]))) {
    
            file writer_add_bytes "w1" [bytes];
    
        };
    
        #Force to write;
        file writer_flush "w1";
    
        #Close the reader and the writer;
        file reader_close "r1";
        file writer_close "w1";
    
    } {
    
        #Close objects;
        try {file reader_close "r1";} {} "[sub_err]";
        try {file writer_close "w1";} {} "[sub_err]";
    
        #Generate an error;
        exception (1) ([err]);
    
    } "[err]";
Services     Supporters     Contact     About     Legal notice © 2023