I have a code like this:
NSData *data = [NSData dataWithContentsOfURL:objURL]; const void *buffer = [data bytes]; [self _loadData:buffer]; [data release];
The _loadData function takes an argument of the type:
- (void)_loadData:(const char *)data;
How to convert "const void" to "const char" on Objective-C?
Like in C:
[self _loadData:(const char *)buffer];
must work.
You should not release a data object because you have not explicitly allocated it. Alternatively, you can make a simple actor:
[self _loadData:(const char *) buffer];
Source: https://habr.com/ru/post/1706675/More articles:C #: No castings in Generics? - genericsC #: creating an installer that installs a WPF application (ClickOnce) and a Windows service - c #How to write a schema function that takes two lists and returns four lists - lispAdvanced MySQL Am I missing a point? - mysqlWhy am I getting an exception raised from Spring.NET when I call ContextRegistry.GetContext ()? - c #If (fileUpload.HasFile) = false - vb.netWhat is the point in Max (Threading.Interlocked.Increment (Offset), Offset - 1)? - multithreadingchecking namespace in xml string or URI? - xmlTime-tested application testing in Python - pythonWho is responsible for attaching students to the injection scheme without initialization? - dependency-injectionAll Articles