51Testing软件测试论坛

标题: lr_paramarr_idx使用的求助 [打印本页]

作者: error1    时间: 2014-6-20 18:27
标题: lr_paramarr_idx使用的求助
  1. Example: lr_paramarr_idx and lr_paramarr_len

  2. This example shows how to get the last value from a parameter array.

  3. int arrSize;

  4. char * FlightVal;

  5. web_reg_save_param("outFlightVal",

  6.     "LB=outboundFlight value=", "RB=>",

  7.     "ORD=ALL",

  8.     "SaveLen=18",

  9.     LAST );

  10. web_submit_form("reservations.pl",

  11.     "Snapshot=t4.inf",

  12.     ITEMDATA,

  13.     "Name=depart", "Value=London", ENDITEM,

  14.     "Name=departDate", "Value=11/20/2003", ENDITEM,

  15.     "Name=arrive", "Value=New York", ENDITEM,

  16.     "Name=returnDate", "Value=11/21/2003", ENDITEM,

  17.     "Name=numPassengers", "Value=1", ENDITEM,

  18.     "Name=roundtrip", "Value=<OFF>", ENDITEM,

  19.     "Name=seatPref", "Value=None", ENDITEM,

  20.     "Name=seatType", "Value=Coach", ENDITEM,

  21.     "Name=findFlights.x", "Value=83", ENDITEM,

  22.     "Name=findFlights.y", "Value=16", ENDITEM,

  23.     LAST );

  24. /*

  25. The result of the web_reg_save_param having been called before the web_submit_form is:

  26. Notify: Saving Parameter "outFlightVal_1 = 230;378;11/20/2003"

  27. Notify: Saving Parameter "outFlightVal_2 = 231;337;11/20/2003"

  28. Notify: Saving Parameter "outFlightVal_3 = 232;357;11/20/2003"

  29. Notify: Saving Parameter "outFlightVal_4 = 233;309;11/20/2003"

  30. Notify: Saving Parameter "outFlightVal_count = 4"

  31. */

  32. arrSize = lr_paramarr_len("outFlightVal");

  33. FlightVal = lr_paramarr_idx("outFlightVal", arrSize);

  34. // FlightVal contains the value "233;309;11/20/2003".
复制代码
以上是官方帮助文档里的,以下是我自己的
  1. srand(time(NULL));
  2.         i = rand()%20;
  3.         i = i+1;
  4.         lr_save_string(lr_paramarr_idx("projSysID",i),"p_projSysID");
  5.         lr_output_message("p_projSysID=%s",lr_eval_string("{p_projSysID}"));
  6. //最后的输出如下:
  7. Action.c(145): p_projSysID={projSysID_5}
复制代码
问下为什么输出的不是projSysID_9的值???
作者: lsekfe    时间: 2014-7-3 15:37
LZ这个问题解决了吗?帮LZ召唤下大神吧~




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2