• Post Reply Bookmark Topic Watch Topic
  • New Topic

vector of bytes  RSS feed

 
J Cleary
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there, i have an array of bytes that i want to store in a vector, is this possible since it is a primitive?
 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by J Cleary:
hello there, i have an array of bytes that i want to store in a vector, is this possible since it is a primitive?


The array of bytes is actually an object, so you can add the whole array to the vector as one element.

If you want to add the individual elements of the array to the vector, then you need to wrap it in a Byte class first.

Henry
 
J Cleary
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh yes as in new Byte(variable)!! Thank you, problem solved. cheers
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!