memmove/cpy

This is a discussion on memmove/cpy within the Windows Programming forums, part of the Platform Specific Boards category; When this line is executed I get an error that the memory is not accessable; memmove(Text.string+ index + size,Text.string+index,Text.len - ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    161

    memmove/cpy

    When this line is executed I get an error that the memory is not accessable;

    memmove(Text.string+ index + size,Text.string+index,Text.len - index);

    Text.string is a pointer to a string. I want to make room to insert text into the string. Any one know why I get memory error messages?

    Thanx in advance?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Pointer to what sort of string

    char *bad = "this cannot be modified";

    char good[100] = "this can be modified";
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    char *string;
    string = (char *) calloc(length, 1);

    I want to modify "string".

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21