Search code examples
type-conversioncapl

Is there a way to convert integer to char in CAPL?


I try to write a integer variable into a file by using the filePutString() function in CAPL. Is there a way to convert the integer into char, since filePutString() only uses chars as parameter.


Solution

  • I suppose the best way would be to use snprintf.

    char buffer[100];
    int number = 10;
    snprintf(buffer, elcount(buffer), "Text: %d", number);