类型const的操作数void所需的arihmetic或指针类型

时间:2014-06-23 07:57:07

标签: ios filestream iostream streamwriter

为什么我收到错误: 操作数,如果类型为const void,则对于以下行需要arithmentic或指针类型:

//将数据插入文件中的特定位置

 NSData *chunk = chunkContainer; // some data
        NSUInteger insertPoint = chunkNo*512; // get the insertion point //
        // make sure the file exists, if it does, do the following //
        NSData *oldData = [NSData dataWithContentsOfFile:filePath];
        // error checking would be nice... if (oldData) ... blah //
        NSOutputStream *stream = [[NSOutputStream alloc] initToFileAtPath:filePath append:NO];
        [stream open];
        [stream write:(uint8_t *)[oldData bytes] maxLength:insertPoint]; // write the old data up to the insertion point //
        [stream write:(uint8_t *)[chunk bytes] maxLength:[chunk length]]; // write the new data //

//THE NEXT LINE IS THE LINE I AM GEETING THE ERROR AT 
  [stream write:(uint8_t *)[oldData bytes][insertPoint] maxLength:([oldData length] - insertionPoint)]; // write the rest of old data at the end of the file //
        [stream close];

0 个答案:

没有答案