C - Reading a file into a byte array


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I'm trying to read a file into a byte array in C. I have to use C as this is for a loadrunner script which is based on the C programming language
The .Net code from the developers I'm basically trying to simulate in C is below. I'm not a C programmer but have done some basic C programming as required in my loadrunner scripts so this is a bit out of my depth. Any help would be very appraciated
Did you know?Explore Trending and Topic pages for more stories like this.

Thanks

/// Loads the file to the upload request.

///

/// The upload document request.

/// Name of the file.

///

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);

}

}
No comments posted yet

Your Answer:

Login to answer
334 Like 10 Dislike
Previous forums Next forums
Other forums

finding key position of specified value in multi-dimensional array
Code: $openedfile = fopen($tfc_file4, "r");
$rc = 1;
while(!feof($openedfile))
{<

Only add new information from XML to MySQL
What I am doing, is taking a xml file, and adding the values to a database. However, what I want to

New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understan

iMatch stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_

how to export excel file in same server
My first post - php newbie, so appreciate your support.

I'm currently using headers to save w

file downloaded can't be read !!
<?php
$fileName = 'mypic.jpg';
$mimeType = 'image/jpeg';
header('content-dispositio

Images in email problem
I found this script for sending emails, it works but if the email has <img src="image.jp

Something like an INI editor or a DelimitedText-Editor
Hi all,

Am very, very, very new to PHP and not sure if I should be posting this to a Javascri

grouping within a foreach?
hello all,

I currently have a list of products spit out from my db via a foreach loop. Right

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash