Re: Pro*C/C++ : How can i manage text files in RAW or LONG type
Date: 1997/09/15
Message-ID: <341E26EF.939B2222_at_pangeasystems.com>#1/1
As far as I know, you can't get the size of a LONG field unless you pull it out of the database. This can be kind of tricky--you have to know how big it is so you can make space for it, but the reason you are pulling it out is because you don't know how big it is. . . . You can allocate a very large character array and read into it. I've done this, but be careful not to stack allocate it--some systems have small stack limits so you'll have to fool the compiler with something like.
struct mylong {
int len; char data[MAX_RECORD];
}
.....
#ifdef PROC_PRECOMP
mylong files[barray_size];
#else
mylong* files; files = (mylong*) malloc (sizeof(mylong) * barray_size);#endif
.....
Also, if you want to read more than one out of the database at a time, there is some trickiness-the length field of your long struct will be ignored after the first read.
-A
Pierre Didierjean wrote:
> Hello
>
> I'm looking for an example in PRO*C to manage text file in RAW or LONG
>
> mode ...
>
> How can i get the exact size of the text file in the database ?
> I don't want to add a column with the size of each text.
>
> Thanks
-- --------------------------------------------------------------------------- Archie Russell Pangea Systems, Inc. archier_at_pangeasystems.com http://www.pangeasystems.com ---------------------------------------------------------------------------Received on Mon Sep 15 1997 - 00:00:00 CEST