|
From: Alan W. I. <ir...@be...> - 2002-07-03 18:42:55
|
I am not too proficient in C so this took me a while, but I believe the
standard C function strncpy will do what you want. Here is a short example.
#include <stdio.h>
#include "plplot/plplotP.h"
main()
{
char short_version[]="x.x";
strncpy(short_version, PLPLOT_VERSION, 3);
printf("%s\n",PLPLOT_VERSION);
printf("%s\n",short_version);
}
The result of compiling and running this code was a printout of
5.1.0
5.1
Alan
email: ir...@be...
phone: 250-727-2902 FAX: 250-721-7715
snail-mail:
Dr. Alan W. Irwin
Department of Physics and Astronomy,
University of Victoria, P.O. Box 3055,
Victoria, British Columbia, Canada, V8W 3P6
__________________________
Linux-powered astrophysics
__________________________
On Wed, 3 Jul 2002, Vince Darley wrote:
> On Wed, 3 Jul 2002, Alan W. Irwin wrote:
> > PLPLOT_VERSION is already accessible from tclAPI.c via the plplot/plplotP.h
> > include which in turn includes plConfig.h. Can you parse out the parts
> > you need to replace 5.1 and 5.1.0 wherever they occur in tclAPI.c? That
> > would greatly simplify my life at release time.
>
> Ideally tclAPI.c needs both "5.1.0" and "5.1". But plConfig.h only
> provides "5.1.0" (in PLPLOT_VERSION). I don't know how to write a macro
> to extract the first bit of that string, and I certainly don't know
> anything about auto_conf. Perhaps best is to change tclAPI.c so that we
> use "5.1.0" everywhere.
>
> I can easily do that, but extracting "5.1" if it is possible, would be
> nicer...
>
> Vince.
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> No, I will not fix your computer.
> http://thinkgeek.com/sf
> _______________________________________________
> Plplot-devel mailing list
> Plp...@li...
> https://lists.sourceforge.net/lists/listinfo/plplot-devel
>
|