Dynamic array

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2004
Posts: 4,461
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 254
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Dynamic array

 
0
  #31
Sep 7th, 2007
Snippets out of context don't receive real answers.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 185
Reputation: eranga262154 is an unknown quantity at this point 
Solved Threads: 2
eranga262154's Avatar
eranga262154 eranga262154 is offline Offline
Junior Poster

Re: Dynamic array

 
0
  #32
Sep 7th, 2007
What you mean. Is the not enough details there.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,461
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 254
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Dynamic array

 
0
  #33
Sep 7th, 2007
I can't compile your previous code and run it. If you could actually post the current code that demonstrates the issue you are facing, it would expedite the most correct answer.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 185
Reputation: eranga262154 is an unknown quantity at this point 
Solved Threads: 2
eranga262154's Avatar
eranga262154 eranga262154 is offline Offline
Junior Poster

Re: Dynamic array

 
0
  #34
Sep 7th, 2007
Ok, here's the full code.

  1. #include <iostream>
  2. #include <fstream>
  3. #include <limits>
  4. #include <bitset>
  5.  
  6. using namespace std ;
  7.  
  8. int main()
  9. {
  10. ofstream filebin ;
  11. filebin.open("RecordBinaryData.txt") ;
  12.  
  13. ifstream file ( "path to binary file" ) ;
  14. file >> noskipws ;
  15. typedef bitset< numeric_limits<unsigned char>::digits > bitset ;
  16. unsigned char byte ;
  17. long count = 0 ;
  18.  
  19. if(filebin.is_open())
  20. {
  21. while( file >> byte )
  22. {
  23. //cout << bitset(byte) ; // to print bits as it is
  24. filebin << bitset(byte) ;
  25. count ++ ;
  26. }
  27. const long const_count = count ;
  28. long arr[const_count] ;
  29.  
  30. filebin.close() ;
  31. }
  32.  
  33. else
  34. {
  35. cout << "Unable to open the file.\n" ;
  36. }
  37.  
  38. cin.get() ;
  39. return 0 ;
  40. }

I have attached the binary file as well.
Attached Files
File Type: zip G00046_002_01.zip (443.1 KB, 1 views)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 4040 | Replies: 33
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC