Skip site navigation (1) Skip section navigation (2)

Conversion between BpChar and "C" char

From: dawizz <wwwillem(at)zonnet(dot)nl>
To: pgsql-novice(at)postgresql(dot)org
Subject: Conversion between BpChar and "C" char
Date: 2005-11-18 16:51:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Dear all,

Can anyone give me a hint about converting and casting between
BpChar and char..  I'm trying to return the value off buff, and I have the 
example from one site in zcech language. So I'm looking for the missing 
link.. Because I think I do not handle the memory calls correclty     ;-(
If I get on the right rack I'm very pleased ofcource...	;-)

    int     *idx;
    int     *varlen;
    char    *buff[40];
    char    *term = "\n";
    char    *line = "-";

    varlen = (int *) flow;

    while (idx <= varlen) {
        buff[*idx]          = line;
        buff[*idx +1]       = term;

    BpChar *result = palloc (VARHDRSZ + 1);
    VARATT_SIZEP (result) = VARHDRSZ + 1;
    *(VARDATA (result)) = 'M';

    PG_RETURN_BPCHAR_P (result);

Thanks in advance, kind regards,

pgsql-novice by date

Next:From: Roland GieslerDate: 2005-11-18 17:07:14
Subject: Large Objects in table
Previous:From: AnnounceDate: 2005-11-18 15:17:14
Subject: Re: org.postgresql.Driver

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group