User Tag List

Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    unable to use full C library - trying to read file

    1. What version of LoadRunner (LR) or PerformanceCenter (PC) are you using? (specify which tool LR or PC)
    LR 9.51

    2. What is the protocol you are recording?
    Web Services

    2.1 If .NET, which version of .NET does the app require?

    2.2 If .NET, which version of .NET do you have installed?

    2.3 If OracleNCA with Oracle Forms Server, please list the version of Oracle Forms Server. You can get this info from the main Oracle Form when launched - Help -> About

    3. If HTML - are you using HTML-Advanced with URLs or,
    (indicate yes/no)

    4. If URL mode:
    - Concurrent groups, or
    - Without Concurrent groups?
    (indicate which)

    5. Which LoadRunner/PerformanceCenter feature (FPs) or service packs are you using?

    6. VuGen Recording - are you using Old or New Recording Engine?

    7. You must list here the specific Licensed Vuser type for your specific issue AND the license amount you have for your Vuser protocol(s) - per the example below (Unlimited, Permanent, N/A, etc. are not options) If you are using a cracked or hacked version, list as "CRACK".

    Citrix 100
    Web 2.0 1000
    Oracle 1000

    8. Is your support/maintenance contract current and active?

    9. What platform(s) (PCs) and Operating Systems (Windows-XP, etc.) are being used for load generators and controllers? Include version and service packs (SP1 or 2, etc.)
    Windows XP SP2

    10. If you have filed a service request with HP/Mercury, what have they told you at this point with respect to your issue?

    ************************************************** ******


    I'm trying to write some C code that will read a file into a byte array and then use it in a web service call. In order to do this I need to include stdio.h & stdlib.h in my vugen script (ie #include <stdio.h&gt. Whe I try to do this the script won't complie and I get the following error

    C:\Program Files\HP\Service Test\include/crtdefs.h:40:43: #error ERROR: Only Win32 target supported!

    Is there a way to get access to all C programming header files in loadrunner or is there a way in loadrunner to read a file byte by byte into an array. The .Net code the developers use to create the byte array is below so I'm basically trying to simulate this in either loadrunner functions or C code

    /// <summary>

    /// Loads the file to the upload request.

    /// </summary>

    /// <param name="uploadDocumentRequest">The upload document request.</param>

    /// <param name="fileName">Name of the file.</param>

    /// <returns></returns>

    private void LoadFileToUploadRequest(UploadDocumentRequest uploadDocumentRequest, String fileName)


    if (File.Exists(fileName))


    FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);

    BinaryReader br = new BinaryReader(fs);

    uploadDocumentRequest.Data = br.ReadBytes((int)fs.Length);



    The code sample I found on the internet to do something similar is below hoever this does not work without the stdio.h & stdlib.h mentioned above.

    #include <stdio.h>
    #include <stdlib.h>

    int main(void)
    char buffer[5] = {0}; /* initialized to zeroes */
    int i, rc;
    FILE *fp = fopen("myfile", "rb");
    if (fp == NULL) {
    perror("Failed to open file \"myfile\"");
    return EXIT_FAILURE;
    for (i = 0; (rc = getc(fp)) != EOF && i < 5; buffer[i++] = rc)
    if (i == 5) {
    puts("The bytes read were...");
    printf("%x %x %x %x %x\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4]);
    } else
    fputs("There was an error reading the file.\n", stderr);
    return EXIT_SUCCESS;

  2. #2
    Join Date
    Aug 2001
    Post Thanks / Like
    0 Post(s)
    1 Thread(s)

    Re: unable to use full C library - trying to read file

    take a look at the example for fopen in LoadRunner. You may be surprised how similar to your example is the one included with LoadRunner.

    Much of stdio is bundled behind the covers in LoadRunner, so you don't need to explicitly include the file references. You can check this with the examples of fopen and related functions in the help file.
    James Pulley

    Replace ineffective offshore contracts, LoadRunnerByTheHour. Starting @ $19.95/hr USD.

    Put us to the test, skilled expertise is less expensive than you might imagine.

    Twitter: @LoadRunnerBTH @PerfBytes



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:17 AM.

Copyright BetaSoft Inc.