Re: Problemas al imprimir cadenas de caracteres

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Juan Pablo Espino <jp(dot)espino(at)gmail(dot)com>
Cc: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, "pgsql-es-ayuda(at)postgresql(dot)org" <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Problemas al imprimir cadenas de caracteres
Date: 2005-04-18 23:51:35
Message-ID: 20050418235135.GA10279@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Mon, Apr 18, 2005 at 06:33:46PM -0500, Juan Pablo Espino wrote:

Hola,

> Bueno intente esto pero no me funciona

Hum! Prueba esto

#include "postgres.h"
#include "fmgr.h"

PG_FUNCTION_INFO_V1(ej2);

Datum
ej2(PG_FUNCTION_ARGS)
{
int32 x = PG_GETARG_INT32(0);
text *t = PG_GETARG_TEXT_P(1);
int32 z;
int32 new_size = VARSIZE(t) - VARHDRSZ;
char *new = (char *) palloc(new_size + 1);

memcpy(new, t->vl_dat, new_size);
new[new_size] = '\0';
z = x*8;
elog(INFO, "Cadena: %s", new);
PG_RETURN_INT32(z);
}

--
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
Jude: I wish humans laid eggs
Ringlord: Why would you want humans to lay eggs?
Jude: So I can eat them

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Juan Pablo Espino 2005-04-19 00:05:38 Re: Problemas al imprimir cadenas de caracteres
Previous Message Juan Pablo Espino 2005-04-18 23:33:46 Re: Problemas al imprimir cadenas de caracteres