VuGen Code Snippets | JDS Australia [PDF]

Note that this repository does not contain trivial examples (i.e. something you could learn by looking at the example co

3 downloads 15 Views 165KB Size

Recommend Stories


Snippets
No amount of guilt can solve the past, and no amount of anxiety can change the future. Anonymous

Snippets
Pretending to not be afraid is as good as actually not being afraid. David Letterman

Shire Snippets
Everything in the universe is within you. Ask all from yourself. Rumi

JDS WIND
Raise your words, not voice. It is rain that grows flowers, not thunder. Rumi

Engineers Australia Code of Ethics
How wonderful it is that nobody need wait a single moment before starting to improve the world. Anne

Building Code of Australia 2012
No amount of guilt can solve the past, and no amount of anxiety can change the future. Anonymous

jds uniphase corporation
What you seek is seeking you. Rumi

Harvest Snippets Summary
The butterfly counts not months but moments, and has time enough. Rabindranath Tagore

Structured Snippets extensions
What we think, what we become. Buddha

NMSU Data Snippets
Stop acting so small. You are the universe in ecstatic motion. Rumi

Idea Transcript


About

Services

Products

Partners

Resources

Support

Contact

/* Writes a string to the end of a file. Arguments: - file_name: Include the full path in the file name, and escape any slashes. E.g. "C:\\TEMP\\output.txt". Note that file does not have to exist beforehand, but directory does. - string: If attempting to write a single line, include a newline character at the end of the string. Returns 0 on success. On failure, function will raise lr_error_message and return -1. */ int jds_append_to_file(char* file_name, char* string) { int fp; // file pointer int rc; // return code int length = strlen(string); // Check that file_name is not NULL. if (file_name == NULL) { lr_error_message("Error. File name is NULL"); return -1; } fp = fopen(file_name, "a"); // open file in "append" mode. if (fp == NULL) { lr_error_message("Error opening file: %s", file_name); return -1; } rc = fprintf(fp, "%s", string); if (rc != length) { lr_error_message("Error writing to file: %s", file_name); return -1; } rc = fclose(fp); if (rc != 0) { lr_error_message("Error closing file: %s", file_name); return -1; } return 0; }

// Checks if a file already exists on the filesystem. // Arguments: // - file_name: Include the full path in the file name. // Returns TRUE (1) if file exists and user has read access to the file, otherwise function returns FALSE (0). int jds_file_exists(char* file_name) { int fp; // file pointer fp = fopen(file_name, "r+"); // open file in read mode. File must already exist. if (fp == NULL) { return FALSE; } else { fclose(fp); return TRUE; } }

// Saves a file to the hard disk. // Arguments: // - file_name: Include the full path in the file name. Note that file must not exist before function is called. // - file_content: The RB/BIN=", "Search=Body", LAST); // Note that it is best to use web_custom_request, as this guarantees that only one file is being downloaded by this step. web_custom_request("DownloadPlugin", "URL=http://www.example.com/files/test.zip", "Method=GET", "Resource=1", "RecContentType=text/css", "Referer=https://www.jds.net.au", "Snapshot=t1.inf", LAST); // returns the size of the previous HTTP response size = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE); jds_save_file(file, lr_eval_string("{FileContents}"), size); return 0; }

web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

int fp; // filestream pointer int sz; // file size fp = fopen("E:\\LoadRunner\\Scripts\\bet365.zip", "r+b"); // open in binary mode (read-only). File must exist. fseek(fp, 0, SEEK_END); // sets the position indicator associated with the stream to the end of the file. sz = ftell(fp); // standard C function to return the current value of the position indicator of the stream. For binary streams, this is the number of bytes from the beginning of the file. This function is undocumented in the VuGen help file. lr_output_message("size: %d", sz); // size in bytes

//Creates a directory using the given path name. int mkdir ( const char *path );

Enter your comment here...

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.