Re: Get/Put read/write efficiency

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"mayayana" <mayaXXyana@xxxxxxxxx> wrote in message news:OTR841adJHA.3520@xxxxxxxxxxxxxxxxxxxxxxx

I was thinking there might be some kind of
syntax like a pointer in an API function, a way
to tell it to start writing from array(x). OK.

Yes, you can do that, as has been mentioned in a couple of responses, by setting up a temporary Byte array the same size as the data block you wish to load and then loading the file data into it and then using CopyMemory to copy the loaded block of data data into the main large array which contains the entire file. But there is no need to set up a temporary array at all if you don't wish to. You can do exactly what you have asked (tell it to start writing from array(x) and specify how many bytes you want) by setting up a SafeASrray structure and pointing it at the desired data position in the large array. This involves swapping only a four byte pointer no matter how many data bytes you wish to read or write. See my two recent responses for details.

Mike


.



Relevant Pages

  • Re: gdb not catching out-of-bounds pointer
    ... is also not defined by the C-standard, IOW: writing code in anything ... provided the library writer knows what the compiler writer guarantees ... etc.) that don't point into the same array than I would about the sort ... of pointer aliasing issue that started this sub-thread. ...
    (comp.unix.programmer)
  • Re: Answer needed
    ... as the last element of the array the data was written outside the allotted ... I re-wrote the offending function with proper checks of the pointer value. ... > including what you expect writing code to see what the result will be ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Problem with pointer to array of structures
    ... I have been writing with C ... but usually I try to avoid complicated pointer stuff such as ... not an array of pointers to structs? ...
    (comp.lang.c)
  • Re: fast array copy
    ... > I'm writing a function that updates an array. ... a pointer NOT an array and an array is NOT a pointer. ... There are some types of lists you can use depending on the type of ...
    (comp.lang.c)
  • Re: char **argv & char *argv[]
    ... "pointer to pointer to char". ... >> pointer)) pointing to the first element of an array. ... so we have to start adding more context. ... type "pointer to char", rather than "array MISSING_SIZE of char". ...
    (comp.lang.c)