Announcement

Collapse
No announcement yet.

More C Help needed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • More C Help needed

    Hi All, I am converting a C header for CDBFAPI and getting a little stuck,
    I have converted the FILTERVAR struct but am confused about the defines
    below it.
    Also how best to declare this in a UDT
    should it be ASCIIZ or STRPTR ?
    Code:
    char  *normal_case;
    
    and
    struct DBF*    __stdcall  OpenBase  (char *filename);       //open database     
    DECLARE FUCNTION OpenBase(FileName as ASCIIZ) as DBF PTR   ??
    Any help appreciated.

    Code:
    'struct FilterVar {
    '        char    v[1024];          //result STRING
    '        char    c[1024];          //temporary simple condition
    '        INT     t[1024];          //offset's of |&
    '        INT     vr;               //offset IN result STRING
    '        char    LEFT[1024];       //LEFT operand
    '        char    RIGHT[1024];      //RIGHT operand
    '        };
    TYPE FilterVar
      v            AS STRING * 1024
      c            AS STRING * 1024
      t(1024)      AS LONG
      vr           AS LONG
      sleft        AS STRING * 1024
      sright       AS STRING * 1024
    END TYPE
    
    #define flt_c           d->filvar->c
    #define flt_v           d->filvar->v
    #define flt_t           d->filvar->t
    #define flt_vr          d->filvar->vr
    #define flt_left        d->filvar->LEFT
    #define flt_right       d->filvar->RIGHT
    Last edited by Neil J Hosgood; 22 Feb 2009, 01:57 AM.

  • #2
    Code:
    DECLARE FUCNTION OpenBase LIB "cdbfapi.dll" ALIAS "OpenBase" (FileName as ASCIIZ) AS DWORD
    Code:
    TYPE FilterVar
      v            AS ASCIIZ * 1024
      c            AS ASCIIZ * 1024
      t(1023)      AS LONG   ' 0 TO 1023
      vr           AS LONG
      sleft        AS ASCIIZ * 1024
      sright       AS ASCIIZ * 1024
    END TYPE
    You don't need to translate the defines. They are simple shortcuts to access the members of the structure.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Great, thanks for that.

      Comment


      • #4
        One more thing......

        char *filename_bak; //NAME OF .bak file

        is this a byte, pointer or asciiz ??


        cheers,

        Neil.

        Comment


        • #5
          Asciiz Ptr.
          Last edited by José Roca; 22 Feb 2009, 10:05 PM.
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment

          Working...
          X