| 6 | #include "gmt.h" |
| 7 | #include <string.h> |
| 8 | int main () { |
| 9 | char output[GMT_VF_LEN] = {""}; |
| 10 | char *arg[4] = {"-Ccool", "-T1/65/1", "-N", NULL}; |
| 11 | void *P = NULL, *API = NULL; |
| 12 | |
| 13 | /* Initialize the GMT session */ |
| 14 | API = GMT_Create_Session ("GMT_makecpt", 2, 0, NULL); |
| 15 | /* Open a virtual file to hold the CPT */ |
| 16 | GMT_Open_VirtualFile (API, GMT_IS_PALETTE, GMT_IS_NONE, GMT_OUT, NULL, output); |
| 17 | /* Finalize the 4 arguments with the filename */ |
| 18 | arg[3] = (char*) calloc(strlen(output)+3, sizeof(char)); |
| 19 | sprintf(arg[3], "->%s", output); |
| 20 | /* Create the CPT to be returned back to us via the virtual file */ |
| 21 | GMT_Call_Module (API, "makecpt", 4, arg); |
| 22 | /* Get the CPT in memory */ |
| 23 | P = GMT_Read_VirtualFile(API, output); |
| 24 | /* Write the CPT to the file output.cpt */ |
| 25 | GMT_Write_Data (API, GMT_IS_PALETTE, GMT_IS_FILE, GMT_IS_NONE, GMT_CPT_NO_BNF, NULL, "output.cpt", P); |
| 26 | /* Destroy session */ |
| 27 | if (GMT_Destroy_Session (API)) return EXIT_FAILURE; |
| 28 | } |
nothing calls this directly
no test coverage detected