OK....How do we do this

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TGF

    #1

    OK....How do we do this


    Here is some C code....


    unsigned char *bytePtr;

    handle = open(filename, r);

    bytePtr = new (unsigned char *)malloc(256);

    if (handle!=-1) {
    bytesRead = read(handle, buffer, 256);
    if (bytesRead>0) {
    // do stuff with bytePtr at the byte level
    // i.e. bytePtr++, bytePtr += 30;
    ...
    ...
    }
    }

    ....What would be the most effecient way to do this using Managed C++? Now
    remember, I have alot of code that needs access to the data read at the byte
    level.

    -TGF




  • Pent

    #2
    Re: OK....How do we do this

    FileStream* fs...;
    Byte buf[4096];
    int read = fs->Read(buf, 0, buf->Length);
    char __pin* ptr = &buf[0];

    Then you manipulate ptr like normal in C++
    ....

    "TGF" <tfitz@engr.uco nn.edu[remove brackets]> wrote in message
    news:O2UzM7HpDH A.2416@TK2MSFTN GP10.phx.gbl...[color=blue]
    >
    > Here is some C code....
    >
    >
    > unsigned char *bytePtr;
    >
    > handle = open(filename, r);
    >
    > bytePtr = new (unsigned char *)malloc(256);
    >
    > if (handle!=-1) {
    > bytesRead = read(handle, buffer, 256);
    > if (bytesRead>0) {
    > // do stuff with bytePtr at the byte level
    > // i.e. bytePtr++, bytePtr += 30;
    > ...
    > ...
    > }
    > }
    >
    > ...What would be the most effecient way to do this using Managed C++? Now
    > remember, I have alot of code that needs access to the data read at the[/color]
    byte[color=blue]
    > level.
    >
    > -TGF
    >
    >
    >
    >[/color]


    Comment

    Working...