Question

L'exemple ci-dessous doit travailler avec des chaînes Unicode, mais il ne fonctionne pas.


CFStringRef aString =  CFSTR("one"); // in real life this is an Unicode string
CFStringRef formatString = CFSTR("This is %s example"); // also tried %S but without success
CFStringRef resultString = CFStringCreateWithFormat(NULL, NULL, formatString, aString);

// Here I should have a valid sentence in resultString but the current result is like aString would contain garbage.
Était-ce utile?

La solution

Utilisez %@ si vous souhaitez inclure un CFStringRef via CFStringCreateWithFormat.

Voir

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top