Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-17-2005
zhangzq71's Avatar
zhangzq71 zhangzq71 is offline
Registered User
 
Name: ZhangZQ
Organization: WanYi
Project: Test
 
Join Date: Mar 2005
Location: GuangZhou, GuangDong
Posts: 43
Send a message via ICQ to zhangzq71 Send a message via MSN to zhangzq71 Send a message via Skype™ to zhangzq71
-->
How to define this in slice?

Supposing I have a C function

int ReadFile(int hFile, byte* pBuffer, int nBufLen);

How to define the pBuffer in slice? is sequence<byte> the only way? if so, the nBufLen is no necessary, right?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 07-17-2005
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,060
Yes, that is correct.

Matthew
Reply With Quote
  #3 (permalink)  
Old 07-17-2005
zhangzq71's Avatar
zhangzq71 zhangzq71 is offline
Registered User
 
Name: ZhangZQ
Organization: WanYi
Project: Test
 
Join Date: Mar 2005
Location: GuangZhou, GuangDong
Posts: 43
Send a message via ICQ to zhangzq71 Send a message via MSN to zhangzq71 Send a message via Skype™ to zhangzq71
-->
Is it possible to define the ReadFile in Slice as

int ReadFile(int hFile, byte* pBuffer, int nBufLen); ??


Regards,
ZhangZQ
Reply With Quote
  #4 (permalink)  
Old 07-17-2005
zhangzq71's Avatar
zhangzq71 zhangzq71 is offline
Registered User
 
Name: ZhangZQ
Organization: WanYi
Project: Test
 
Join Date: Mar 2005
Location: GuangZhou, GuangDong
Posts: 43
Send a message via ICQ to zhangzq71 Send a message via MSN to zhangzq71 Send a message via Skype™ to zhangzq71
-->
The slice compiler seems does not support

int ReadFile(int hFile, byte* pBuffer, int nBufLen);

If I want to transfer large amount of data, sequence is the only way??
Reply With Quote
  #5 (permalink)  
Old 07-17-2005
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 912
Quote:
Originally Posted by zhangzq71
The slice compiler seems does not support

int ReadFile(int hFile, byte* pBuffer, int nBufLen);

If I want to transfer large amount of data, sequence is the only way??
Yes. Passing a pointer to a buffer doesn't make sense because the buffer is in the sender's address space and pointer value would not make sense in the receiver's address space. In other words, what you must transfer is the data itself, not just a pointer to the data. Transmitting a sequence of bytes does exactly that.

Cheers,

Michi.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to define a variant type? fengxb Help Center 2 07-31-2005 11:45 AM


All times are GMT -4. The time now is 10:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.