On Mon, Sep 8, 2008 at 3:25 PM, John McKown <[EMAIL PROTECTED]> wrote: > If I am copying literal text into a char array, which do you think is > better: > > strcpy(dest,"LITERAL"); > > OR > > memcpy(dest,"LITERAL",8); > > ?? I lean towards memcpy because the C run-time reference says that it is > a builtin function and done in-line. Which I would guess would mean better > performance. Why don't I just look at the generated code? Because I don't > have a C compiler for z/OS. I'm writing my code on Linux using GCC. > > -- > Q: What do theoretical physicists drink beer from? > A: An EIN stein. > > Maranatha! > John McKown > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > >
Why not using strncpy() as this will just copy bytes until the first NULL found instead of copying the whole length? Ricardo Lee ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

