Skip to content

Instantly share code, notes, and snippets.

@jslegendre
Created February 3, 2018 05:18
Show Gist options
  • Save jslegendre/b39accece42c2746234f753f7d3f6b63 to your computer and use it in GitHub Desktop.
Save jslegendre/b39accece42c2746234f753f7d3f6b63 to your computer and use it in GitHub Desktop.
Create CFString from CLI arguments in C
/***************************
Compile with:
gcc -framework CoreFoundation
****************************/
#include <CoreFoundation/CoreFoundation.h>
int main(int argc, char** argv) {
CFStringRef myCFString = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingMacRoman);
/* Use myCFString */
CFRelease(myCFString);
}
//https://developer.apple.com/documentation/corefoundation/cfstring?language=objc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment