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 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
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.
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
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.
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).