Re: [C] simple string question

From: AirPete (x_at_x.x)
Date: 02/05/04


Date: Thu, 05 Feb 2004 13:02:47 GMT

Alan wrote:
[snip]
>>
>> memcpy("abcd", string, sizeof(string));
>
> sorry, but it doesn't work
> when I run the program, the program crashes

Sorry, I got the arguments misordered, it should be:
memcpy(string, "abcd", sizeof(string));

>
>>
>> - Pete



Relevant Pages

  • Re: [C] simple string question
    ... Alan wrote: ... > when I run the program, the program crashes ... memcpy(string, "abcd", sizeof(string)); ...
    (comp.lang.c)
  • Re: [C] simple string question
    ... > Alan wrote: ... >> then in a function at some time, I want to set the string to a ... >> what is the correct code? ... the program crashes ...
    (comp.lang.c)
  • Re: [C] simple string question
    ... > Alan wrote: ... >> then in a function at some time, I want to set the string to a ... >> what is the correct code? ... the program crashes ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Error Reporting
    ... Thank you for your cogent replies. ... Alan ... > Whenever a program crashes or I have to stop an application that's not ... XP wants to send an error report to Microsoft. ...
    (microsoft.public.windowsxp.perform_maintain)