*DECK LCMGTC
      SUBROUTINE LCMGTC(IPCPO,NAME,LENG,NLIN,CARR)
*
*-----------------------------------------------------------------------
*
*Purpose:
* get an array of character variables from a LCM table component.
*
*Copyright:
* Copyright (C) 2002 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): A. Hebert
*
*Parameters: input
* IPCPO   pointer to the LCM object.
* NAME    character name of the LCM node.
* LENG    length of each character variable in the array CARR.
* NLIN    dimension of array CARR.
*
*Parameters: output
* CARR    array of character variables.
*
*-----------------------------------------------------------------------
*
      USE GANLIB
*----
*  SUBROUTINE ARGUMENTS
*----
      TYPE(C_PTR) IPCPO
      INTEGER LENG,NLIN
      CHARACTER*(*) NAME,CARR(NLIN)
*----
*  LOCAL VARIABLES
*----
      CHARACTER*13  FMT
      INTEGER, ALLOCATABLE, DIMENSION(:,:) :: IBASE
      CHARACTER*12 TEXT12
*
      FMT='(           )'
      ALLOCATE(IBASE((LENG+3)/4,NLIN))
*----
*  Read from LCM object
*----
      CALL LCMLEN(IPCPO,NAME,ILONG,ITYLCM)
      IF(ILONG.EQ.0) THEN
         CALL LCMLIB(IPCPO)
         TEXT12=NAME
         CALL XABORT('LCMGTC: RECORD '//TEXT12//' NOT FOUND.')
      ENDIF
      CALL LCMGET(IPCPO,NAME,IBASE)
*----
*  Define format and dimensions for conversion
*----
      N=LENG/4
      M=MOD(LENG,4)
      IF(N.GT.0)WRITE(FMT(2:9),'(I6,''A4'')') N
      IF(M.GT.0)THEN
         IF(N.GT.0)FMT(10:10)=','
         WRITE(FMT(11:12),'(''A'',I1)') M
         N=N+1
      ENDIF
*----
*  Convert integers to strings
*----
      DO 10 I=1,NLIN
         WRITE(CARR(I)(1:LENG),FMT) (IBASE(J,I),J=1,N)
  10  CONTINUE
      DEALLOCATE(IBASE)
*
      END
