Y-lib
Loadrunner libraries
Data Structures | Macros | Typedefs | Functions
vugen.h File Reference

Standard C function headers. More...

Go to the source code of this file.

Data Structures

struct  tm
 Documented at http://www.cplusplus.com/reference/ctime/tm/.
Values outside of valid ranges can be used to calculate a new date/time using mktime. E.g. tm_mday = 0 means last day of previous month. More...
 
struct  _timeb
 Used by ftime. Defined as _timeb (instead of timeb) just as in the on-line Help. More...
 
struct  lconv
 Returned by localeconv. Documented at http://www.cplusplus.com/reference/clocale/lconv/. More...
 

Macros

#define strcat(to, from)   0_DO_NOT_USE_strcat_THERE_IS_ALWAYS_A_BETTER_SOLUTION
 Force a compile time error when strcat() is used.
Because the use of strcat() is a very strong indicator for poorly written code being compiled – there is always a better solution! More...
 
#define strcpy(dest, source)   0_DO_NOT_USE_strcpy_DUPLICATION_IS_NOT_REQUIRED
 Force a compile time error when strcpy() is used.
The use of strcpy is banned because in practice strcpy is only used by novice coders doing unnecessary duplicating. (Typically when trying to avoid using pointers when actually using pointers.)
Evaluate your coding solution and avoid duplication. If you must, use the safer strncpy or snprintf. More...
 
#define FILENAME_MAX   1024
 
#define L_tmpnam   FILENAME_MAX
 
#define SEEK_SET   0
 set file offset to offset More...
 
#define SEEK_CUR   1
 set file offset to current plus offset More...
 
#define SEEK_END   2
 set file offset to EOF plus offset More...
 
#define _IOFBF   0
 setvbuf should set fully buffered More...
 
#define _IOLBF   1
 setvbuf should set line buffered More...
 
#define _IONBF   2
 setvbuf should set unbuffered More...
 
#define EOF   (-1)
 the End-Of-File constant More...
 
#define LC_ALL   0
 
#define LC_COLLATE   1
 
#define LC_CTYPE   2
 
#define LC_MONETARY   3
 
#define LC_NUMERIC   4
 
#define LC_TIME   5
 
#define LC_MESSAGES   6
 

Typedefs

typedef long time_t
 Type time_t can hold a Unix timestamp. More...
 

Functions

int snprintf (char *buffer, size_t n, const char *format_string,...)
 Documented at http://www.cplusplus.com/reference/cstdio/snprintf/.
This function was introduced by the latest revision of the C++ standard (2011). Older compilers may not support it. More...
 
int sprintf (char *buffer, const char *format_string,...)
 Documented at http://www.cplusplus.com/reference/cstdio/sprintf/.
You should prefer snprintf over sprintf. More...
 
int sscanf (const char *buffer, const char *format_string,...)
 Documented at http://www.cplusplus.com/reference/cstdio/sscanf/. More...
 
char * strchr (const char *string, int c)
 Documented at http://www.cplusplus.com/reference/cstring/strchr/. More...
 
int strcmp (const char *string1, const char *string2)
 Documented at http://www.cplusplus.com/reference/cstring/strcmp/. More...
 
char * strdup (const char *string)
 Documented at http://pubs.opengroup.org/onlinepubs/007904975/functions/strdup.html . More...
 
int stricmp (const char *string1, const char *string2)
 Documented at http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rtref/stricmp.htm . More...
 
size_t strlen (const char *string)
 Documented at http://www.cplusplus.com/reference/cstring/strlen/. More...
 
char * strlwr (char *string)
 Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/s/strlwr.html . More...
 
char * strncat (char *to_string, const char *from_string, size_t n)
 Documented at http://www.cplusplus.com/reference/cstring/strncat/. More...
 
int strncmp (const char *string1, const char *string2, size_t n)
 Documented at http://www.cplusplus.com/reference/cstring/strncmp/. More...
 
int strnicmp (const char *string1, const char *string2, size_t num)
 Documented at http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rtref/strnicmp.htm. More...
 
char * strncpy (char *destination, const char *source, size_t num)
 Documented at http://www.cplusplus.com/reference/cstring/strncpy/. More...
 
char * strrchr (const char *string, int c)
 Documented at http://www.cplusplus.com/reference/cstring/strrchr/. More...
 
char * strset (char *string1, int character)
 Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/s/strset.html . More...
 
size_t * strspn (const char *string, const char *skipset)
 Documented at http://www.cplusplus.com/reference/cstring/strspn/. More...
 
char * strstr (const char *string1, const char *string2)
 Documented at http://www.cplusplus.com/reference/cstring/strstr/. More...
 
char * strtok (char *string, const char *delimiters)
 Documented at http://www.cplusplus.com/reference/cstring/strtok/. More...
 
char * strupr (char *string)
 Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/s/strupr.html . More...
 
double atof (const char *string)
 Documented at http://www.cplusplus.com/reference/cstdlib/atof/. More...
 
int atoi (const char *string)
 Documented at http://www.cplusplus.com/reference/cstdlib/atoi/. More...
 
long atol (const char *string)
 Documented at http://www.cplusplus.com/reference/cstdlib/atol/. More...
 
int itoa (int value, char *str, int radix)
 Documented at http://www.cplusplus.com/reference/cstdlib/itoa/. More...
 
long strtol (const char *string, char **endptr, int radix)
 Documented at http://www.cplusplus.com/reference/cstdlib/strtol/. More...
 
unsigned long int strtoul (const char *str, char **endptr, int base)
 Documented at http://www.cplusplus.com/reference/cstdlib/strtoul/. More...
 
double strtod (const char *str, char **endptr)
 Documented at http://www.cplusplus.com/reference/cstdlib/strtod/. More...
 
int isalnum (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isalnum/. More...
 
int isalpha (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isalpha/. More...
 
int iscntrl (int character)
 Documented at http://www.cplusplus.com/reference/cctype/iscntrl/. More...
 
int isdigit (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isdigit/. More...
 
int isgraph (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isgraph/. More...
 
int islower (int character)
 Documented at http://www.cplusplus.com/reference/cctype/islower/. More...
 
int isprint (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isprint/. More...
 
int ispunct (int character)
 Documented at http://www.cplusplus.com/reference/cctype/ispunct/. More...
 
int isspace (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isspace/. More...
 
int isupper (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isupper/. More...
 
int isxdigit (int character)
 Documented at http://www.cplusplus.com/reference/cctype/isxdigit/. More...
 
int tolower (int character)
 Documented at http://www.cplusplus.com/reference/cctype/tolower/. More...
 
int toupper (int character)
 Documented at http://www.cplusplus.com/reference/cctype/toupper/. More...
 
void * memchr (const void *s, int c, size_t n)
 Documented at http://www.cplusplus.com/reference/cstring/memchr/. More...
 
int memcmp (const void *s1, const void *s2, size_t n)
 Documented at http://www.cplusplus.com/reference/cstring/memcmp/. More...
 
void * memcpy (void *dest, const void *src, size_t n)
 Documented at http://www.cplusplus.com/reference/cstring/memcpy/. More...
 
void * memmove (void *dest, const void *src, size_t n)
 Documented at http://www.cplusplus.com/reference/cstring/memmove/. More...
 
void * memset (void *buffer, int c, size_t n)
 Documented at http://www.cplusplus.com/reference/cstring/memset/. More...
 
void * calloc (size_t num_elems, size_t elem_size)
 Documented at http://www.cplusplus.com/reference/cstdlib/calloc/. More...
 
void free (void *mem_address)
 Documented at http://www.cplusplus.com/reference/cstdlib/free/. More...
 
void * malloc (size_t num_bytes)
 Documented at http://www.cplusplus.com/reference/cstdlib/malloc/. More...
 
void * realloc (void *mem_address, size_t size)
 Documented at http://www.cplusplus.com/reference/cstdlib/realloc/. More...
 
time_t time (time_t *timeptr)
 Documented at http://www.cplusplus.com/reference/ctime/time/. More...
 
char * ctime (const time_t *calTime)
 Documented at http://www.cplusplus.com/reference/ctime/ctime/. More...
 
struct tmgmtime (const time_t *calTime)
 Documented at http://www.cplusplus.com/reference/ctime/gmtime/. More...
 
char * asctime (const struct tm *tmTime)
 Documented at http://www.cplusplus.com/reference/ctime/asctime/. More...
 
size_t * strftime (char *string, size_t maxlen, const char *format, const struct tm *timestruct)
 Documented at http://www.cplusplus.com/reference/ctime/strftime/. More...
 
time_t mktime (struct tm *timeptr)
 Documented at http://www.cplusplus.com/reference/ctime/mktime/. More...
 
struct tmlocaltime (const time_t *timer)
 Documented at http://www.cplusplus.com/reference/ctime/localtime/. More...
 
void tzset (void)
 Documented at http://www.cplusplus.com/reference/ctime/tzset/. More...
 
void ftime (struct _timeb *time)
 Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/f/ftime.html . More...
 
int fclose (long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/fclose/. More...
 
int feof (long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/feof/. More...
 
int ferror (long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/ferror/. More...
 
int fgetc (long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/fgetc/. More...
 
char * fgets (char *string, int maxchar, long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/fgets/. More...
 
int fputs (const char *str, long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/fputs/. More...
 
long fopen (const char *filename, const char *access_mode)
 Documented at http://www.cplusplus.com/reference/cstdio/fopen/. More...
 
int fprintf (long file_pointer, const char *format_string,...)
 Documented at http://www.cplusplus.com/reference/cstdio/fprintf/. More...
 
int fputc (int c, long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/fputc/. More...
 
size_t fread (void *buffer, size_t size, size_t count, long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/fread/. More...
 
int fscanf (long file_pointer, const char *format_string,...)
 Documented at http://www.cplusplus.com/reference/cstdio/fscanf/. More...
 
int fseek (long file_pointer, long offset, int origin)
 Documented at http://www.cplusplus.com/reference/cstdio/fseek/. More...
 
long ftell (long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/ftell/. More...
 
size_t fwrite (const void *buffer, size_t size, size_t count, long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/fwrite/. More...
 
void rewind (long file_pointer)
 Documented at http://www.cplusplus.com/reference/cstdio/rewind/. More...
 
long tmpfile (void)
 Documented at http://www.cplusplus.com/reference/cstdio/tmpfile/. More...
 
char * tmpnam (char *str)
 Documented at http://www.cplusplus.com/reference/cstdio/tmpnam/. More...
 
int setvbuf (long file_pointer, char *buffer, int mode, size_t size)
 Documented at http://www.cplusplus.com/reference/cstdio/setvbuf/. More...
 
int getw (long file_pointer)
 Documented at http://man7.org/linux/man-pages/man3/getw.3.html . More...
 
int pclose (long file_pointer)
 Documented at http://man7.org/linux/man-pages/man3/pclose.3.html . More...
 
long popen (const char *command, const char *access_mode)
 Documented at http://man7.org/linux/man-pages/man3/popen.3.html . More...
 
int putw (int word, long file_pointer)
 Documented at http://man7.org/linux/man-pages/man3/putw.3.html . More...
 
char * getenv (const char *varname)
 Documented at http://www.cplusplus.com/reference/cstdlib/getenv/. More...
 
int putenv (const char *envstring)
 Documented at http://www.cplusplus.com/reference/cstdlib/putenv/. More...
 
int system (const char *string)
 Documented at http://www.cplusplus.com/reference/cstdlib/system/.
The popen function is more useful in LR scripts. More...
 
int chdir (const char *path)
 Documented at http://man7.org/linux/man-pages/man2/chdir.2.html . More...
 
int chdrive (int drive)
 See on-line help. More...
 
char * getcwd (char *path, int numchars)
 See on-line help. More...
 
int getdrive (void)
 See on-line help. More...
 
int remove (const char *path)
 Documented at http://www.cplusplus.com/reference/cstdio/remove/. More...
 
int rename (const char *oldname, const char *newname)
 Documented at http://www.cplusplus.com/reference/cstdio/rename/. More...
 
int rmdir (const char *path)
 See on-line help. More...
 
char * setlocale (int category, const char *locale)
 Documented at http://www.cplusplus.com/reference/clocale/setlocale/. More...
 
struct lconvlocaleconv (void)
 Documented at http://www.cplusplus.com/reference/clocale/localeconv/. More...
 
int abs (int n)
 Documented at http://www.cplusplus.com/reference/cstdlib/abs/. More...
 
double fabs (double x)
 Documented at http://www.cplusplus.com/reference/cmath/fabs/. More...
 
double ceil (double x)
 Documented at http://www.cplusplus.com/reference/cmath/ceil/. More...
 
double floor (double x)
 Documented at http://www.cplusplus.com/reference/cmath/floor/. More...
 
double fmod (double numerator, double denominator)
 Documented at http://www.cplusplus.com/reference/cmath/fmod/. More...
 
double modf (double x, double *intpart)
 Documented at http://www.cplusplus.com/reference/cmath/modf/. More...
 
double exp (double x)
 Documented at http://www.cplusplus.com/reference/cmath/exp/. More...
 
double sqrt (double x)
 Documented at http://www.cplusplus.com/reference/cmath/sqrt/. More...
 
double pow (double base, double exponent)
 Documented at http://www.cplusplus.com/reference/cmath/pow/. More...
 
double log (double x)
 Documented at http://www.cplusplus.com/reference/cmath/log/. More...
 
double log10 (double x)
 Documented at http://www.cplusplus.com/reference/cmath/log10/. More...
 
double log2 (double x)
 Documented at http://www.cplusplus.com/reference/cmath/log2/. More...
 
double sin (double x)
 Documented at http://www.cplusplus.com/reference/cmath/sin/. More...
 
double cos (double x)
 Documented at http://www.cplusplus.com/reference/cmath/cos/. More...
 
int rand (void)
 Documented at http://www.cplusplus.com/reference/cstdlib/rand/. More...
 
int srand (unsigned int seed)
 Documented at http://www.cplusplus.com/reference/cstdlib/srand/. More...
 
void sleep (DWORD dwMilliseconds)
 Windows API uninterruptable sleep in LR, better to use lr_force_think_time() or lr_usleep() instead. More...
 

Detailed Description

Standard C function headers.

This header file contains the most used 'standard C functions' in Vugen scripts.
By declaring these functions properly the compiler can check if these functions are used correctly and apply implicit conversions when necessary.
This header file 'de-strips' the compiler in Vugen.
It contains all functions mentioned in the HP LoadRunner Online Function Reference.

Note
Sites like http://www.cplusplus.com/reference/clibrary/ explain the standard C functions better than the HP LoadRunner Online Function Reference and more.

Usage: Automatically included as part of y-lib. To use this stand-alone add vugen.h to the script and add the following to globals.h or vuser_init.c:

#include "vugen.h"

Or: add to include-directory and add the #include to lhrun.h on all Vugen machines and load generators.
Initial version 2012-03-27, last update 2014-01-09

Author
A.U. Luyer
Warning
lrun.h contains:
#define size_t int
causing size_t to be defined as signed integer, which is incorrect.

Definition in file vugen.h.

Function Documentation

int rand ( void  )
void sleep ( DWORD  dwMilliseconds)

Windows API uninterruptable sleep in LR, better to use lr_force_think_time() or lr_usleep() instead.

int srand ( unsigned int  seed)