whitelion_pc 0 Newbie Poster

Can anyone help me convert this C# code to C code? with "character" is a string variable and "desired_output_bit" was defined.

int byteCount = unicode.GetByteCount(character.ToCharArray());
			byte[] bytes = new Byte[byteCount];			
			bytes= unicode.GetBytes(character);
			BitArray bits = new BitArray( bytes );
			System.Collections.IEnumerator bit_enumerator = bits.GetEnumerator();
			int bit_array_length = bits.Length;				
			bit_enumerator.Reset ();
			for(int i=0;i<bit_array_length;i++)
			{
				bit_enumerator.MoveNext();						
				if(bit_enumerator.Current.ToString()=="True")
					desired_output_bit[i]=1;
				else
					desired_output_bit[i]=0;				
			}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.