Thread

  1. How do I construct a varlena?

    Oliver Elphick <olly@lfix.co.uk> — 1998-08-04T10:07:54Z

    Can you tell me, please, how to construct a varlena (to be returned by
    a function).
    
    I see it is declared as an int and a 1-byte array; I don't know how to
    assign a longer string in place of that 1-byte array; the compiler
    complains about incompatible types, whatever I do.
    
    Thank you.
    
    -- 
    Oliver Elphick                                Oliver.Elphick@lfix.co.uk
    Isle of Wight                              http://www.lfix.co.uk/oliver
                   PGP key from public servers; key ID 32B8FAA1
                     ========================================
         "And not only so, but we glory in tribulations also; 
          knowing that tribulation worketh patience; And  
          patience, experience; and experience, hope."          
                                            Romans 5:3,4 
    
    
    
    
  2. Re: [HACKERS] How do I construct a varlena?

    Maarten Boekhold <maartenb@dutepp2.et.tudelft.nl> — 1998-08-04T14:28:21Z

    On Tue, 4 Aug 1998, Oliver Elphick wrote:
    
    > Can you tell me, please, how to construct a varlena (to be returned by
    > a function).
    > 
    > I see it is declared as an int and a 1-byte array; I don't know how to
    > assign a longer string in place of that 1-byte array; the compiler
    > complains about incompatible types, whatever I do.
    
    If I'm correct:
    
    	malloc(sizeof(VARLENA) + l);
    
    where 'l' is the length of the string you want to put in (without the
    trailing '\0').
    
    Maarten
    
    _____________________________________________________________________________
    | TU Delft, The Netherlands, Faculty of Information Technology and Systems  |
    |                   Department of Electrical Engineering                    |
    |           Computer Architecture and Digital Technique section             |
    |                          M.Boekhold@et.tudelft.nl                         |
    -----------------------------------------------------------------------------