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

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

Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The

how to make database item unique
Hey guys,

is it possible to do this:

I have the database item $title being pulled for

very easy question about SQL info
Hello,
I think that I have a very easy question.
I know how to create a form using php SQL and

"SEO" URLs
Hey, I'm wondering how to go about creating and using these types of URLs. I'm presuming it's PHP th

Convert .fdf to .pdf
I currently have a web form that uploads the form data to an .fdf file and emails it.

However

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

is_dir() problem
Hello,

I'm buidling a php scripts that dynamically get's subfolders from a specific folder.

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

Login logout link help
Hi all,

Im new to php and Im having trouble creating a login/logout link for my page that dis

db entry based on primary key
My "topics" table contains 10 entires
*--------------*
topicid topic
------

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