Delete text file

Author: admon_yd2003@yahoo.com (orna)

Hi

U 7.2.06
I need to delete and copy  text files.
Tried: activate "winapi".DELETEFILE(filename)
and got -59 "Unable to locate 3GL function deletefileA"
In the .INI file under "demandload" there is a reference to the kernel32.dll,
the "winapi" signature is compiled.
Is there something that is missing?
and is there another way to do it (delete file) without using API?

TIA

4 Comments

  1. Hi orna,

    in Uniface 8+ there is the command "lfiledelete" etc.

    In Version 6, I used a BAT file to rename/copy/delete files (called via a link, so we could hide the window). 

    Success, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. As long as you're on Uniface 7, there is no lfiledelete, that's from version 8 and on, like Uli already mentioned.

    Your solution should work; I use it too on my old 7.2.06 environment (migrating to 9 at the moment).

    First of all: Please check the paths to the dll in the usys.ini. These will vary per (Windows) platform. My usys.ini looks like this (for W2K PC's):

    [userdlls]
    demandload=c:\winnt\system32\advapi32.dll,c:\winnt\system32\kernel32.dll,c:\winnt\system32\shell32.dll

    The "DeleteFile" or  "DeleteFileA" is a kernel32 function.

    My code looks like this:

    operation DeleteFile

    params
       string    ps_FileName   :IN
    endparams

    activate "kernel32".DeleteFile(ps_FileName)

    return ($status)

    end ; DeleteFile

    And my signature "kernel32" has the operation "deletefile" with one in-parameter "filename", type string, interface char *, length 256. (Windows 2000 limits paths to 260 characters total length.)

    Hope this helps!

    Regards, Arjen


    Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
  3. Thanks Uli & Arjen

    The problem with API is that we have users with Windows 2000 & XP
    and the kernel32.dll is not the same, and different .ini file is not an option.
    So, with bat file it works just fine.

     


    Author: orna (admon_yd2003@yahoo.com)
  4. Hi,

    in UF 7  we used for such basic file operations like copy, delete, append, ..  an own dll written in c.
    This dll was linked with the 3GL stuff deliverd by uniface (h / lib)  and the name of the dll was placed in the .ini file in section [userdlls].

    Advantage:
    The functions became a "part" of uniface (activated "silent" by the perform command).

    Disadvantage:
    You need a C-compiler

    But perhaps this could be an alternative solution of calling external bat files for you.

    Kind regards,
    Bertram

     

     

     

     


    Author: BeSieben (bertram.siebenkaes@systec-software.de)