LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-15-2006, 09:19 PM   #1
crapodino
Member
 
Registered: Aug 2005
Distribution: SuSE 10
Posts: 72

Rep: Reputation: 15
STL bit_vector to a binary file


This is simple. HOW CAN I STORE A BIT_VECTOR ( from STL ) INTO A BINARY FILE ?? NOT the pointers of bit_vector. Of course, i want to be able to read the file and have again my bit_vector just as the original. For example: bit_vector x(500)

If someone really knows, please tell me. If it isn't possible i'll have to use an auxiliary array, isn't it ?

i really need to do this

thanks
 
Old 02-15-2006, 10:47 PM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Just take every eight bits, put them together into a byte, and then write the byte. There's nothing special about a bit vector from other types of vectors (how would you "store" other types of vectors?).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot execute binary file on a selfx file brucifer Linux - Software 4 03-21-2006 04:44 AM
sizeof(bit_vector) crapodino Programming 3 02-14-2006 09:25 PM
Automatically tell text file from binary file? Hosiah Linux - Software 3 05-31-2005 05:22 AM
convert text file to binary excel file ust Linux - General 2 11-23-2004 02:33 AM
mounting a binary file thats not on any file system!?!!? aXoneX Linux - General 7 10-26-2004 02:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration