Solved

C# code

Posted on 2010-09-08
3
354 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 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