Solved

Function call

Posted on 2006-11-01
4
245 Views
Last Modified: 2011-09-20
Hi,

I'm trying to convert some C code to VB.Net can anyone explain the following C function call to me.

Thank you.


stream( 1, ck, (unsigned char *)puiData64, (unsigned char *)(&uiIB64) );

0
Comment
Question by:IAJWDDIY
  • 2
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 17852982
it calls the function stream with the arguments
1
ck
puiData64 casted to a pointer to an unsigned character
the address of uiIB64 casted to a pointer to an unsigned char

we may be able to tell you more of we saw the definiton of the stream function and the definitions of
ck, puiData64 and uiIB64
0
 

Author Comment

by:IAJWDDIY
ID: 17853346
These are the definitions and the function.

 unsigned  __int64   uiIB64;
   unsigned  __int64  *puiData64 = (unsigned __int64 *)(&data[ offset ]);

void stream(int init, unsigned char *CK, unsigned char *sb, unsigned char *cb) {

0
 
LVL 45

Accepted Solution

by:
Kdo earned 500 total points
ID: 17857539

Hi IAJWDDIY,

>> unsigned  __int64   uiIB64;

__int64 is an extension to C that specifies that the variable will be a 64 bit integer.  It's one of the few integer types that are guaranteed to be a specific size.  The C RFC doesn't place many restrictions on integer sizes leaving the definition(s) to the implementation.  About the only thing that the RFC does define is that "a short shall not be larger than an int, nor shall an int be larger than a long".  (I used one of the early 64-bit system some years ago where a short, int, or long all resulted in a 64-bit variable!)

The statement above simply declares a 64-bit integer named uiIB64.


>>  unsigned  __int64  *puiData64 = (unsigned __int64 *)(&data[ offset ]);

This declares a variable and initializes it at the same time.  It may or may not be legal, depending upon the compiler.

The variable (puiData64) is a pointer to a 64-bit integer.


>> void stream(int init, unsigned char *CK, unsigned char *sb, unsigned char *cb) {

The program is declaring a function called stream().  The function has 4 parameters -- an integer and 3 pointers to characters (character arrays).



Good Luck,
Kent

0
 

Author Comment

by:IAJWDDIY
ID: 17858699
Thank you again Kent.

p.s Your motto made me laugh!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now