[omniORB] Octet type

Brecht Vermeulen brecht.vermeulen@rug.ac.be
Fri, 23 Mar 2001 17:21:19 +0100


Michel,

this code does this (bytestream is a sequence of octets) :

	
	click_router::bytestream_var errors = new click_router::bytestream;
	
	
	// now read the errors and return them
	ifstream errors_file(CLICK_ERRORS);
	errors->length(2000);		// start length of 2000 octets
	
	CORBA::Octet ch;
	CORBA::ULong i=0;
	while(errors_file.get(ch) ) {
		if (i>errors->length()-1) errors->length(i+500);
		errors[i++] = ch;
	};

	errors->length(i);
															
	errors_file.close();
	
	return errors._retn();

best regards,
Brecht

Miguel wrote:
> 
> Hi
> 
> I have to transmit a texture from a server to a client. It can be in
> different formats (such as .rgb, .jpg, .gif...) so I've decided to
> send all of them as a sequence of octets. The problem is that I don't have
> a good knowledge about using the octet type, so
> I don't know how to read data from the file and convert it to an octet (and
> how to convert an octet to data) (perhaps with
> a simple cast??)
> 
> Any suggestion or info about the octet type?
> 
> Thank you very much.
> 
> Bye.