Results 1 to 3 of 3
  1. #1

    Problem with strncpy

    hi I have tried to copy three first characters from one varialb eto another.
    for some reason it does not work corretly


    here is code:
    char Ctmp1[5];

    strncpy(Ctmp1, lr_eval_string("{POCOVAL}"), 3); //copy 3 first to Ctmp1
    lr_output_message ("tmp= %s", Ctmp1);

    here is log output:
    Notify: Parameter Substitution: parameter "POCOVAL" = "02701"
    tmp= 027sc{Postcode_105}

    I have also tried memcpy(Ctmp1,lr_eval_string("{POCOVAL}"), 3);

    what could cause this?

  2. #2

    Re: Problem with strncpy

    If Ctmp is an automatic variable it's not initialized.
    Unless you are writing a compiler, strtok is NOT the answer.
    See: http://www.sqaforums.com/showflat.ph...=541641#542222

    QAF is still an exercise in self-sufficiency! (Thank JB!)

  3. #3

    Re: Problem with strncpy

    well,your variable is not initialized,you'd set a default to the "Ctmp1"



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 04:14 PM.

Copyright BetaSoft Inc.