Solved

C# code

Posted on 2010-09-08
3
358 Views
Last Modified: 2012-05-10
what does the following line mean and does:
fixed (byte * buffPointer = dataBuffer)                              hllapi(&function, buffPointer, &dataLength, &returnCode);
0
Comment
Question by:vivekj2004
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 33626849
see this: http://blog.dmbcllc.com/2009/01/05/csharp-fixed-keyword/

It looks like you are declaring a function call to hllapi
I'm guess the first part is the return type...
fixed fixes pointers and such, so that they aren't moved around.
buffpointer is a variable-- a pointer to a byte and it is being pointed to dataBuffer

Is this all one line of code or two?
0
 
LVL 8

Accepted Solution

by:
Gururaj Badam earned 500 total points
ID: 33628797
hllapi(&function, buffPointer, &dataLength, &returnCode);

hllapi is a function which takes

Param 1 -> Pointer to a function
Param 2 -> Pointer to a buffer
Param 3 -> May return the length of the data filled in Param 2 post execution
Param 4 -> The state of execution of function
0
 
LVL 13

Expert Comment

by:Naman Goel
ID: 33634251
so its same as the below code where you are calling hllapi method
 
http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/books/html/emulator_programming07.htm
 
EHLLAPI Call Format
The EHLLAPI entry point (hllapi) is always called with the following four parameters: EHLLAPI Function Number (input) Data Buffer (input/output) Buffer Length (input/output) Position (input); Return Code (output)

The prototype for IBM Standard EHLLAPI is: [long hllapi (LPWORD, LPSTR, LPWORD, LPWORD);
The prototype for IBM Enhanced EHLLAPI is: [long hllapi (LPINT, LPSTR, LPINT, LPINT);
Each parameter is passed by reference not by value. Thus each parameter to the function call must be a pointer to the value, not the value itself

fixed (byte * buffPointer = dataBuffer) 
{
 hllapi(&function, buffPointer, &dataLength, &returnCode); 
}

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question