Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-01-2010, 03:57 AM   #1 (permalink)
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,754
Exclamation Need some helo from C# experts

I want to know the equivalent of these classes in Obj-C:

BinaryWriter
StringCollection
MemoryStream

I am trying to basically create a file, bit by bit (from header, etc), I found a code in C#, some part of it I can make sense of it, but Im not sure the equivalent of the above classes/types of C# in Obj-C.

Any C# guru lurking in here, pls help... I would appreciate it very much!!

Thanks.

EDIT: darn it, i mistyped the subject. it is not "helo", but "help". Sorry.
rocotilos is offline   Reply With Quote
Old 02-01-2010, 03:18 PM   #2 (permalink)
Maker of Games
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 395
Default

I'm reasonably familiar with C#, but I only know a minimal amount of Objective-C. If you could tell me what you need to do, I may be able to tell you what you want to use?
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Old 02-01-2010, 03:40 PM   #3 (permalink)
Registered Member
 
Centurion Games's Avatar
 
Join Date: Nov 2009
Location: Beaverton, OR
Posts: 119
Default

Quote:
Originally Posted by rocotilos View Post
I want to know the equivalent of these classes in Obj-C:

BinaryWriter
StringCollection
MemoryStream

I am trying to basically create a file, bit by bit (from header, etc), I found a code in C#, some part of it I can make sense of it, but Im not sure the equivalent of the above classes/types of C# in Obj-C.

Any C# guru lurking in here, pls help... I would appreciate it very much!!

Thanks.

EDIT: darn it, i mistyped the subject. it is not "helo", but "help". Sorry.
I'm not sure of Obj C having familar things, but C does.

BinaryWriter is just equivalent to using fopen and fwrite, to open/create a binary file, and write values to it. (Int, float, short, bytes, etc, not classes/objects)

StringCollection is basically a linked list of null terminated strings. This could be done with Char *, STL String, or maybe NSStrings, I imagine written out to file, it includes a total number of strings, and a number of characters per each string entry.

MemoryStream, is essentially just a dynamically re-sizeable memory block or array that you stuff with values (int, short, float, etc). This can easily be done by just allocating a block of memory, and using memcpy, and resizing as needed.

If you post more specifics or the code itself, might be able to help more.
__________________
Centurion Games|@centuriongames

Last edited by Centurion Games; 02-01-2010 at 03:46 PM.
Centurion Games is offline   Reply With Quote
Old 02-01-2010, 05:54 PM   #4 (permalink)
Maker of Games
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 395
Default

Quote:
Originally Posted by Centurion Games View Post
I'm not sure of Obj C having familar things, but C does.
Despite the name C# is not C derived at all, and really only shares some syntax.

Quote:
BinaryWriter is just equivalent to using fopen and fwrite...
Not 100% sure, it probably depends on what you are wanting to do - have a look in Stream and StreamReader.

Quote:
StringCollection is basically a linked list of null terminated strings...
You probably want to use List<String>? (Assuming you're using C# 2.0 or greater) There are a few other alternatives available though.

Quote:
MemoryStream, is essentially just a dynamically re-sizeable memory block or array that you stuff with values (int, short, float, etc)...
Hmm... You don't normally work with raw memory in C#, what are you trying to do? There is a MemoryStream class in C# not sure if it does what you want?
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Old 02-01-2010, 06:31 PM   #5 (permalink)
Registered Member
 
Centurion Games's Avatar
 
Join Date: Nov 2009
Location: Beaverton, OR
Posts: 119
Default

Quote:
Originally Posted by Mr Jack View Post
Despite the name C# is not C derived at all, and really only shares some syntax.



Not 100% sure, it probably depends on what you are wanting to do - have a look in Stream and StreamReader.



You probably want to use List<String>? (Assuming you're using C# 2.0 or greater) There are a few other alternatives available though.



Hmm... You don't normally work with raw memory in C#, what are you trying to do? There is a MemoryStream class in C# not sure if it does what you want?
Perhaps I misunderstood the OP, I thought he wanted to convert c# code to Obj C/C.
__________________
Centurion Games|@centuriongames
Centurion Games is offline   Reply With Quote
Old 02-02-2010, 02:26 AM   #6 (permalink)
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,754
Default

Hello guys.

Thanks for replying. But yeah my intention was to translate the C# code I found into ObjC.

But, nvm, I have gone on a different route - totally writing the code from scratch using Obj-C.

Thanks for replying.

Anyways, just for info, I am using the NSFileHandle, assign a filehandle to be in writing mode. THen I convert the bytes into NSData, which then I write the data in chunks to the filehandle using writeData: methods. Seems to work ok (same as the C# code I found).

Cheers.
rocotilos is offline   Reply With Quote
Old 02-02-2010, 04:25 AM   #7 (permalink)
Maker of Games
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 395
Default

Quote:
Originally Posted by Centurion Games View Post
Perhaps I misunderstood the OP, I thought he wanted to convert c# code to Obj C/C.
Nah, apparently it was me who misunderstand. Sorry guys
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

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



» Advertisements
» Online Users: 232
16 members and 216 guests
ADY, Alsahir, cacao, dacapo, Dani77, Desert Diva, djohnson, F_Bryant, HemiMG, jansan, M@realobjects, MarkC, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:53 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0