Y-lib
Loadrunner libraries
Macros | Functions
LoadRunner Utils of Ylib

Collection of miscellaneous support functions. More...

Macros

#define y_breadcrumb_reset()   lr_save_string("", "breadcrumb")
 Resets the breadcrumb Use this macro to start a new breadcrumb or to reset an existing one. More...
 
#define y_delay_once(delay_in_seconds)
 Delay for delay_in_seconds seconds, once. This macro will put the code to sleep for the specified amount of seconds, but only the first time the current position in the code is reached. If you use this in more than one place each of the calls will sleep exactly once. More...
 

Functions

static unsigned long y_hash_sdbm (char *str)
 Create a hash of string input. More...
 
int y_rand_in_sliding_window (int lowerbound, int upperbound, int rand_max)
 Generate random number and test if it lies between 2 given boundaries. More...
 
int y_rand_between (int lowerbound, int upperbound)
 Create a random number between two boundaries. (the boundaries are included!) More...
 
int y_save_attribute_to_parameter (char *attrib, char *param)
 Fetch attribute from vUser's command line and store it in a parameter. This will fetch an attribute from the vUser's command line (as set in the scenario or in runtime settings as additional attributes) and stores it in the given parameter. More...
 
int y_save_attribute (char *param)
 Fetch attribute from vUser's command lin and store it in a parameter of the same name. This will fetch an attribute from the vUser's command line (as set in the scenario or in runtime settings (addition attributes)) and stores it in a parameter of the same name. This function is a shortcut to y_save_attribute_to_parameter() More...
 
void y_log_rendezvous_result (int result)
 Process the result code of lr_rendezvous() call to log human readable errors. More...
 
void y_breadcrumb (char *breadcrumb)
 Keep track of the steps in the script. More...
 
int y_write_to_file (char *filename, char *content)
 Write a string to a file. More...
 
int y_write_parameter_to_file (char *filename, char *content_parameter)
 Write the content of a parameter to a file. More...
 
void y_datetime ()
 Saves the current date/time into a LR-parameter. More...
 
int y_workdays_from_today (int workdays)
 Calculate the difference in days between today and X workdays into the future. More...
 
void y_get_disk_space (const char *folder_name, double *available, double *total)
 Get the free disk space on the target folder on the load generator. More...
 
double y_get_free_disk_space_in_mebibytes (const char *folder_name)
 Get the amount of free disk space in the target folder in mebibytes (SI unit) More...
 
double y_get_free_disk_space_percentage (const char *folder_name)
 Get the free disk space percentage on the target folder on the load generator. More...
 
int y_read_file_into_parameter (char *filename, char *param)
 Read the contents of a file into a single parameter. More...
 
void y_user_data_point (char *param)
 Create a user data point for a parameter. More...
 
double y_get_current_time ()
 Get the current time in seconds since 1970, as a double. More...
 
double y_delay_until (double timestamp)
 Delay until a certain time. More...
 
double y_think_time_for_rampup_ext (int rampup_period, double TPS_initial, double TPS_max, int virtual_users)
 Ramp up the load by using varying amounts of think time instead of virtual users. More...
 
double y_think_time_for_rampup (const int rampup_period, double TPS_max)
 Ramp up the load by using varying amounts of think time instead of virtual users. For simulating situations with limited amounts of connections on the client side. More...
 
 y_execute_shell_command (char *command, int debug)
 Execute a windows shell command Implements proper error checking. More...
 
int y_errorcheck (int ok)
 Errorflood guard. Also known as "the error check". More...
 
double y_pace (double pacing_time_in_seconds)
 Improved implementation of loadrunner pacing. More...
 
double y_pace_rnd (double min_pacing_time_in_seconds, double max_pacing_time_in_seconds)
 Improved implementation of loadrunner pacing - with semirandomized pacing. More...
 

Detailed Description

Collection of miscellaneous support functions.

Macro Definition Documentation

#define y_breadcrumb_reset ( )    lr_save_string("", "breadcrumb")

Resets the breadcrumb Use this macro to start a new breadcrumb or to reset an existing one.

Author
Raymond de Jongh
See also
y_breadcrumb()

Definition at line 307 of file y_loadrunner_utils.c.

#define y_delay_once (   delay_in_seconds)
Value:
{ \
static int delay_done = 0; \
\
if( !delay_done ) \
{ \
delay_done = 1; \
lr_force_think_time(delay_in_seconds); \
} \
}

Delay for delay_in_seconds seconds, once. This macro will put the code to sleep for the specified amount of seconds, but only the first time the current position in the code is reached. If you use this in more than one place each of the calls will sleep exactly once.

The particular usecase this was made for is a case where users need to register themselves prior to the actual test run. We want to seperate this registration period from the actual rampup, so when each user finishes registering we want a delay. But, we only want it once, and we will only know that we're done registering when we hit the regular load path for the first time.

Hence: delay_once

This is a macro because a function call would make it impossible to use this more than once in a script - it would execute the delay the first time this function is called, independent of where it was called from. Which would be rather counterintuitive.

Author
Floris Kraak

Definition at line 768 of file y_loadrunner_utils.c.

Function Documentation

void y_breadcrumb ( char *  breadcrumb)

Keep track of the steps in the script.

Adds (another) string (read: step) to the LR-parameter {breadcrumb} Use this to keep track of the steps taken by the script. Very useful if you have a script which does things in a random order and you want to know (in the end) which order it actually used. You can, of course, write this to a (log)file. Don't forget to use y_breadcrumb_reset() to clear the parameter at the start of the script. (else you end up with a very long breadcrumb (breadstick?).)

Parameters
[in]breadcrumb
Returns
LR parameter {breadcrumb}
1 y_breadcrumb_reset(); // clean the breadcrumb-variable. (previous data in {breadcrumb} is deleted.
2 y_breadcrumb("start");
3 // .... some code....
4 y_breadcrumb("processing data")
5 //... some code ....
6 y_breadcrumb("finished")
7 The result is that {breadcrumb} contains "start;processing data;finished"
See also
y_breadcrumb_reset()
Author
Raymond de Jongh

Definition at line 283 of file y_loadrunner_utils.c.

void y_datetime ( )

Saves the current date/time into a LR-parameter.

Stores the current date/time into LR-parameter {DATE_TIME_STRING} in this format:
YYYYMMDD,HHMMSS (yes, separated by a comma.)

Returns
current date/time into LR-parameter {DATE_TIME_STRING}.
Deprecated:
Note
This doesn't add much. People should be able to call lr_save_datetime() themselves, right? Putting it on the deprecation list for that reason.
1 y_datetime();
2 lr_message("Current date/time: %s", lr_eval_string("{DATE_TIME_STRING}"));
See also
y_get_current_time()
Author
Raymond de Jongh

Definition at line 442 of file y_loadrunner_utils.c.

double y_delay_until ( double  timestamp)

Delay until a certain time.

Returns
the amount of time waited, in seconds.
Author
Floris Kraak

Definition at line 739 of file y_loadrunner_utils.c.

int y_errorcheck ( int  ok)

Errorflood guard. Also known as "the error check".

Prevent error floods by inserting forced thinktime at the start of the iteration if too many successive iterations fail.

Sometimes very long running tests suffer from disruptions halfway through, caused by silly things like backups. In such a situation all users will temporarily fail, causing a sudden flood of log messages on the generator. Keeping the load 'stable' at that stage may also prevent the back-end from coming back up normally after the original disruption has ended. Plus, if the system stays down keeping the full load on it will only cause the generator's log storage to overflow.

Hence this piece of guarding code that will detect such problems inside the virtual user and temporarily lower the load on the system under test until the situation returns to normal (or the test stops).

Usage:

1 y_errorcheck(0); // Marks the start of the iteration, this will insert a forced delay or an abort at this point if too many failed successive iterations occurred.
2 y_errorcheck(1); // Marks the end of the iteration as successful. Resets the error counter.

Three virtual user command line attributes are used to control this functionality:

  • -errorcheck_enabled: 0 or 1; If set to 1 or used as a flag, error flood checking is performed. Otherwise, it is disabled. Default off (0).
  • -errorcheck_limit x[/y]: How many iteration failures are allowed before intervening.
    x is the amount of failed iterations before forcibly pausing the virtual user. Default 10 iterations.
    y (optional) is the amount of failed iterations before aborting. Default off (-1).
  • -errorcheck_pause_time [mm:]ss: The amount of time to pause if the floodguard fires. Default 15:00 or 900 (15 minutes).

Use this in the command line setting in a test scenario. The 'Additional attributes' in the Run-Time settings allows you the set your own defaults in the script.

For example:

1 -errorcheck_enabled -errorcheck_limit 10/20 -errorcheck_pause_time 5:00

This will force an extra pacing of 5 minutes after 10 successive failed iterations and aborts after 20 successive failed iterations.

Warning
the "errorcheck_enabled" attribute must be set to a positive integer number for this code to do anything!
Note
The forced pause ignores runtime thinktime settings.
This will call y_pace() using the enforced pausing time to make sure it's internal administration doesn't get confused.
Parameters
[in]okStart/end iteration marker. Must be set to 0 at the start of the iteration, and 1 at the end of the iteration.
Author
André Luyer, Floris Kraak

Definition at line 1028 of file y_loadrunner_utils.c.

y_execute_shell_command ( char *  command,
int  debug 
)

Execute a windows shell command Implements proper error checking.

Todo:
Fix the memory allocation to provide for commands that result in more than 10Kb of output.
Parameters
[in]commandA windows shell command, as passed to CMD.exe
[in]debugIf zero, log the first line; Otherwise, log full command output.
Author
Sander van Wanrooij, Floris Kraak

Definition at line 916 of file y_loadrunner_utils.c.

double y_get_current_time ( )

Get the current time in seconds since 1970, as a double.

Returns
The current time in seconds since 1970-01-01 00:00 UTC
Author
Floris Kraak

Definition at line 726 of file y_loadrunner_utils.c.

void y_get_disk_space ( const char *  folder_name,
double *  available,
double *  total 
)

Get the free disk space on the target folder on the load generator.

In order to prevent loadrunner logs from filling up disks on the generator beyond capacity we need to know how much free space the log file system has. This function retrieves information about the amount of space that is available on a disk volume, which is the total amount of space and the total amount of free space available to the vuser.

Parameters
[in]folder_nameThe name of the folder to report on. If this parameter is NULL, the function uses the root of the current disk.
[out]availableThe total number of free bytes on a disk that are available to the vuser
[out]totalThe total number of bytes on a disk that are available to the vuser

Both parameters available and total may by NULL when not required. If per-user quotas are being used, the value(s) may be less than the total number of (free) bytes on a disk. The value of 0 is returned on error (e.g. no access to disk).

Remarks
Completely rewritten. The 16 TiB limit is lifted.
Author
André Luyer

Definition at line 542 of file y_loadrunner_utils.c.

double y_get_free_disk_space_in_mebibytes ( const char *  folder_name)

Get the amount of free disk space in the target folder in mebibytes (SI unit)

Parameters
[in]folder_nameThe name of the folder to report on.
Returns
The amount of mebibytes free, as a double.
Note
This function is a wrapper around y_get_disk_space for backwards compatibility
See also
y_get_disk_space()
Author
André Luyer

Definition at line 604 of file y_loadrunner_utils.c.

double y_get_free_disk_space_percentage ( const char *  folder_name)

Get the free disk space percentage on the target folder on the load generator.

Parameters
[in]folder_nameThe name of the folder to report on.
Returns
The percentage of free space, as a double.
Note
This function is a wrapper around y_get_disk_space for backwards compatibility
See also
y_get_disk_space()
Author
André Luyer

Definition at line 623 of file y_loadrunner_utils.c.

static unsigned long y_hash_sdbm ( char *  str)
static

Create a hash of string input.

A fairly simple hash that can be used to compare long input texts with each other. This uses the sdbm algorithm, described at http://www.cse.yorku.ca/~oz/hash.html.

Parameters
[in]strThe string to create a hash from.
See also
http://www.cse.yorku.ca/~oz/hash.html
Returns
hash (unsigned long)
Author
Floris Kraak

Definition at line 57 of file y_loadrunner_utils.c.

void y_log_rendezvous_result ( int  result)

Process the result code of lr_rendezvous() call to log human readable errors.

When calling lr_rendezvous() the result code indicates the end state of the rendezvous. This function will translate the codes into human readable errors which are then logged as normal.

Parameters
[in]resultcode from lr_rendezvous()
Returns
None
1 {
2  int result = lr_rendezvous("03_Portefeuille");
3 
4  y_start_transaction("Rendezvous_me");
5  // Perform the transaction in question.
6  y_end_transaction("", LR_AUTO);
7 
8  y_log_rendezvous_result(result);
9 }
Author
Floris Kraak

Definition at line 223 of file y_loadrunner_utils.c.

double y_pace ( double  pacing_time_in_seconds)

Improved implementation of loadrunner pacing.

Normal loadrunner pacing (as set by runtime settings) does not really deal with situations in which increases in response time cause the iteration to exceed it's normal pacing settings. If you set a pacing of 60 seconds, and the script takes 180 seconds to execute one iteration, the next iteration will still be 60 seconds - meaning the script will have executed at best 2 iterations in 240 seconds - putting only half the load on the target system, quite probably not something that was intended.

In order to mitigate this we can do two things:

  • Measure how much time iterations take, and produce warnings (error transactions) when this time is exceeded (which is what y_session_timer_start() and y_session_timer_end() in y_transaction.c do; or
  • Do the pacing ourselves, by taking into account how much time has passed since the script started and compensating for overruns by reducing pacing accordingly.

This function implements the latter method.

The way that this works is simple: First, it measures how much time passed since the first time it was called. Then it compares that to a running total of how much time should have passed since that time. If this more time should have passed than has actually passed, it will force a thinktime equal to the gap. Finally, it takes the pacing time argument that was passed in (in seconds, as a double, so fractions of a second are allowed) as an argument, and adds that to the running total of how much time should have passed - to be used the next time around.

Warning
This was designed to be put this at the beginning of each iteration. Not the end. If you put this function anywhere in the iteration after requests started being performed any errors will cause the iteration to abort and the running total to get schewed - it will be as if there was no iteration at all. The next time around it will seem that the iteration took even longer ..
Note
One thing other tools do to deal with this (notably gatling) is ramping up more users. This works as well .. but it's not the panacea certain proponents of this method claim it is. Notably, these users will have to start fresh at the beginning of their clickflow (/path) resulting in more load in the steps leading up to the slower steps. Real users may just hit F5, though ..
Warning
y_think_time_for_rampup(), y_errorcheck(), y_session_timer_start(), and y_session_timer_end() all implement closely related functionality. If you use this please think carefully about how these functions interact with each other.
Note
This will create a user datapoint called y_pacing_time that can be used for monitoring the calculations during the test.

Example:

1 Action()
2 {
3  y_pace(5); // Call this at the *beginning* of each iteration. See the documentation as for why.
4  if( y_rand() % 10 < 3 )
5  {
6  lr_log_message("Haha!");
7  lr_force_think_time(10);
8  }
9  return;
10 }
Parameters
[in]pacing_time_in_seconds- average pacing time. It is recommended this number is kept constant unless you know exactly what you're doing.
Author
Floris Kraak

Definition at line 1149 of file y_loadrunner_utils.c.

double y_pace_rnd ( double  min_pacing_time_in_seconds,
double  max_pacing_time_in_seconds 
)

Improved implementation of loadrunner pacing - with semirandomized pacing.

Parameters
[in]min_pacing_time_in_seconds- minimum pacing time.
[in]max_pacing_time_in_seconds- maximum pacing time.

A random value between these minimum and maximum is chosen using y_drand() and used to call y_pace().

See also
y_pace()
Author
Floris Kraak

Definition at line 1189 of file y_loadrunner_utils.c.

int y_rand_between ( int  lowerbound,
int  upperbound 
)

Create a random number between two boundaries. (the boundaries are included!)

When the lower boundary equals the upper boundary, y_rand_between() simply returns the lower boundary.

Parameters
[in]lowerboundLower boundary of the generated number
[in]upperboundUpper boundary of the generated number
Returns
random number

Example:

1 int random;
2 random = y_rand_between(0, 10); // generate a random number between 0 and 10 (including 0 and 10!)
See also
y_rand()
Author
Floris Kraak

Definition at line 137 of file y_loadrunner_utils.c.

int y_rand_in_sliding_window ( int  lowerbound,
int  upperbound,
int  rand_max 
)

Generate random number and test if it lies between 2 given boundaries.

This will generate a random number between (and including) 0 and rand_max, and tell us if that number lies between the lower and upper bounds or not. Boundaries are included!

This is useful for pathing decisions: Say that at point P in a script a choice has to be made between continuing with actions A, B, and C. The decision is made based on a percentage: A = 10% chance, B = 50% chance, C = 40% chance. This function was written to support the code that would make this decision.

Note
y_flow_list.c provides a better and more intuitive alternative for this one. For that reason, we are likely to remove it in the near future.
Deprecated:
Parameters
[in]lowerboundMinumum value
[in]upperboundMaximum value
[in]rand_maxUpper boundary of the random number
Author
Floris Kraak
Returns
0: no, random number lies outside the boundaries
1: yes, random number lies inside the boundaries
<0: input made no sense.
1 y_rand_in_sliding_window(1, 10, 20); // Returns 1 if the random number rolled is 4, and 0 if the random number was 11.
See also
y_rand(), y_flow_list.c

Definition at line 99 of file y_loadrunner_utils.c.

int y_read_file_into_parameter ( char *  filename,
char *  param 
)

Read the contents of a file into a single parameter.

Parameters
[in]filenameThe name of the file to read (relative to script root, or full path)
[in]paramThe name of the parameter to store the file contents in.
Returns
The number of bytes read from the file, or -1 if the file could not be read (but in that case it will also call lr_abort().)
Note
The size of the file is stored in a parameter named "y_size_{param}", where {param} is the name of the parameter you passed in.

This can be used in various situations; For example, situations where you have a template file that you wish to use for various requests. For instance, when all communications are based on a simple XML submit with slightly different (parameterised) contents.

Note
If the file cannot be opened this will call lr_abort().

Example:

1 vuser_init()
2 {
3  // File contains: <xml><customer_element>{customer_id}</customer_element></xml>
4  y_read_file_into_parameter("template.xml", "template_content");
5 }
6 
7 projectname_some_request_transaction()
8 {
9  // double evaluation evaluates the customer id, giving you the request body.
10  lr_save_string(lr_eval_string(lr_eval_string("{template_content}")), "request_body");
11 
12  y_start_transaction("some_request");
13  web_custom_request("some_request",
14  "URL=http://{Host}/some/request/v1/",
15  "Method=POST", "Resource=0",
16  "Body={request_body}",
17  "EncType=text/xml; charset=utf-8",
18  LAST);
19  y_end_transaction("", LR_AUTO);
20 }
Author
Floris Kraak

Definition at line 670 of file y_loadrunner_utils.c.

int y_save_attribute ( char *  param)

Fetch attribute from vUser's command lin and store it in a parameter of the same name. This will fetch an attribute from the vUser's command line (as set in the scenario or in runtime settings (addition attributes)) and stores it in a parameter of the same name. This function is a shortcut to y_save_attribute_to_parameter()

Parameters
[in]paramargument name of both the attribute and the parameter the value should be stored in.
Returns
1 if the attribute exists, -1 if it doesn't, in which case no value is stored in the parameter.

Example:

1 y_save_attribute("server");
2 web_add_auto_filter("Action=Include", "HostSuffix={server}", LAST );
See also
y_save_attribute_to_parameter()
Author
Floris Kraak

Definition at line 194 of file y_loadrunner_utils.c.

int y_save_attribute_to_parameter ( char *  attrib,
char *  param 
)

Fetch attribute from vUser's command line and store it in a parameter. This will fetch an attribute from the vUser's command line (as set in the scenario or in runtime settings as additional attributes) and stores it in the given parameter.

Parameters
[in]attribAttribute name.
[out]paramLR parameter name in which the argument value is stored.
Returns
1 if the attribute exists, -1 if it doesn't, in which case no value is stored in the parameter.

Example:

1 y_save_attribute_to_parameter("server", "nice_server");
2 web_add_auto_filter("Action=Include", "HostSuffix={nice_server}", LAST );
See also
y_save_attribute()
Author
Floris Kraak

Definition at line 163 of file y_loadrunner_utils.c.

double y_think_time_for_rampup ( const int  rampup_period,
double  TPS_max 
)

Ramp up the load by using varying amounts of think time instead of virtual users. For simulating situations with limited amounts of connections on the client side.

As y_think_time_for_rampup_ext(), assuming 1 virtual user and an initial target load of 0.1 TPS (the defaults.

See also
y_think_time_for_rampup_ext()
Parameters
[in]rampup_periodHow long the rampup should take, in seconds. Default 1800 seconds.
[in]TPS_maxEnd rampup with this many transactions / sec in total per virtual user. Default 10. This cannot go higher than 1/average response time - when think time reaches zero.
Author
Floris Kraak

Definition at line 897 of file y_loadrunner_utils.c.

double y_think_time_for_rampup_ext ( int  rampup_period,
double  TPS_initial,
double  TPS_max,
int  virtual_users 
)

Ramp up the load by using varying amounts of think time instead of virtual users.

This can be used for simulating situations with limited amounts of connections on the client side. In such a case we cannot use regular vuser based rampups, so instead we have to gradually lower the thinktime to get a similar effect. This implements a "think time" function that will use responsetime calculations and a TPS target to simulate such a ramp up.

Base formula: TT = threads/TPS(target) - response time

This will be increasing TPS linearly until rampup_period has passed, unless either think time reaches zero or TPS_max is reached. Note that "response time" is actually "time passed since the previous call to this function". This includes wasted time.

For best effect, call this once in vuser_init and once for each transaction. The recommended practice is to overload lr_think_time() with your own version that calls this (or y_think_time_for_rampup()) every time, like so:

Note
This will create a user datapoint called y_thinktime that can be used for monitoring the calculations during the test.

Example:

1 // Call this instead of lr_think_time(), before each transaction.
2 void my_think_time()
3 {
4  y_think_time_for_rampup(1800, 10); // delays for a variable amount of time depending on target load.
5 }
Warning
The actual load achieved is highly dependant on what pacing settings, thinktimes, and calls are used. This assumes you only have one transaction after each call to this function, and that each call uses the same parameters.
Note
The first 3% of the rampup period uses think times calculated as if 3% of the rampup has passed. This is prevents extremely long think times from occurring.
Parameters
[in]rampup_periodHow long the rampup should take, in seconds. Default 1800 seconds.
[in]TPS_initialStart rampup with this many transactions / sec for this transaction, across all virtual users. Default 0,1 TPS.
[in]TPS_maxEnd rampup with this many transactions / sec in total per virtual user. Default 10. This cannot go higher than 1/average response time - when think time reaches zero.
[in]virtual_usersHow many virtual users the script is using. If you use "1", you can just use TPS / virtual user for the initial target TPS. Default 1.
Warning
Do not set TPS_initial lower than 0,1 or the calculated think times may get really large.
Author
Floris Kraak

Definition at line 820 of file y_loadrunner_utils.c.

void y_user_data_point ( char *  param)

Create a user data point for a parameter.

Parameters
[in]paramThe name of a parameter containing an integer or floating point number.

The name of the parameter will be the name of the datapoint that was created.

Example

1 lr_save_int(1, "one");
2 y_user_data_point("one"); // Creates a datapoint named "one", containing a value of 1.
See also
lr_user_data_point()
Author
Floris Kraak

Definition at line 717 of file y_loadrunner_utils.c.

int y_workdays_from_today ( int  workdays)

Calculate the difference in days between today and X workdays into the future.

Calculate the difference in days between today and a date X workdays into the future.

Returns
How many days into the future X workdays will be.

Example:

1 // Reserve a meeting room in 'reservationOffset' days.
2 int daysOffSet = y_workdays_from_today( atoi(lr_eval_string("{reservationOffset}")) );
3 lr_save_datetime("%d-%m-%Y", DATE_NOW + (daysOffSet*ONE_DAY), "ReservationDate");
4 
5 lr_vuser_status_message(lr_eval_string("Running with offset {reservationOffset} at day offset %d"), daysOffSet);
Author
Floris Kraak

Definition at line 466 of file y_loadrunner_utils.c.

int y_write_parameter_to_file ( char *  filename,
char *  content_parameter 
)

Write the content of a parameter to a file.

Write the content of a parameter to a file. Creates the file if it doesn't exist. Appends to an existing file.

Parameters
[in]filenameName of the file in which the content is saved.
[in]content_parameterThe name of the parameter to be saved. No checking is done - if this doesn't exist, it will just write {content_parameter} or something to your file!
Returns
Negative number in case of an error, zero otherwise.
1 int result;
2 y_save_string("a very long string including newlines, null bytes, what have you", "content_parameter");
3 result=y_write_parameter_to_file("c:\\temp.txt", "content_parameter");
4 if (result != 0)
5 { // o dear, something went wrong!
6 }
Author
André Luyer, Floris Kraak
See also
y_write_to_file(), y_read_parameter_from_file()

Definition at line 374 of file y_loadrunner_utils.c.

int y_write_to_file ( char *  filename,
char *  content 
)

Write a string to a file.

Write a string to a file. Creates the file if it doesn't exist. Appends to an existing file.

Parameters
[in]filenameName of the file in which the content is saved.
[in]contentString which is saved into the file
Returns
Negative number in case of an error, zero otherwise.
1 int result;
2 result=y_write_to_file("c:\\temp.txt", "This is a test");
3 if (result != 0)
4 { // o dear, something went wrong!
5 }
Author
Raymond de Jongh
See also
y_write_parameter_to_file()

Definition at line 330 of file y_loadrunner_utils.c.