str.c 832 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*****************************************************************************
  2. *
  3. * MODULE: DBF driver
  4. *
  5. * AUTHOR(S): Radim Blazek
  6. *
  7. * PURPOSE: Simple driver for reading and writing dbf files
  8. *
  9. * COPYRIGHT: (C) 2000 by the GRASS Development Team
  10. *
  11. * This program is free software under the GNU General Public
  12. * License (>=v2). Read the file COPYING that comes with GRASS
  13. * for details.
  14. *
  15. *****************************************************************************/
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include <grass/dbmi.h>
  19. #include <grass/gis.h>
  20. #include "globals.h"
  21. /* save string to value */
  22. int save_string(VALUE * val, char *c)
  23. {
  24. int len;
  25. len = strlen(c) + 1;
  26. val->c = (char *)G_realloc(val->c, len);
  27. strcpy(val->c, c);
  28. return (1);
  29. }