kind of confused how to pack, write, read and unpack a buffer class

Thread Solved

Join Date: Jun 2009
Posts: 341
Reputation: lotrsimp12345 is an unknown quantity at this point 
Solved Threads: 2
lotrsimp12345 lotrsimp12345 is offline Offline
Posting Whiz

kind of confused how to pack, write, read and unpack a buffer class

 
0
  #1
Dec 13th, 2009
Here's what i have. Not sure what it is doing exactly.

You pack a account object and then you write it to the buffer right? So shouldn't it print after i write it?

Main
  1. #include <iostream>
  2. #include <iomanip>
  3. #include "account.h"
  4. #include "Lentext.h"
  5. #include "Deltext.h"
  6.  
  7.  
  8. using namespace std;
  9. int main()
  10. {
  11. int result;
  12. account a;
  13. LengthTextBuffer b;
  14.  
  15. strcpy(a.account_Number,"1111111111");
  16. strcpy(a.name, "Aniket Karmarkar");
  17. strcpy(a.address, "5265 Shotkoski Dr");
  18. strcpy(a.city, "Hoffman Estates");
  19. strcpy(a.state, "IL");
  20. strcpy(a.zip_Code, "60192");
  21. cout<<"person object's data\n";
  22. a.Print(cout);
  23. result=a.Pack(b);
  24. cout<<"result after pack is"<<result;
  25. b.Print(cout);
  26. result=b.Write(cout);
  27. cout<<"result after write is"<<result;
  28.  
  29.  
  30.  
  31. return 0;
  32. }

Account.h
  1. #include <iostream>
  2. #include "Lentext.h"
  3. #include "Deltext.h"
  4.  
  5. #include <string>
  6. using namespace std;
  7. class account
  8. {
  9. public:
  10. char account_Number[11];
  11. char name[1000];
  12. char address[1000];
  13. char city[16];
  14. char state[3];
  15. char zip_Code[10];
  16. char account_Balance[1000];
  17.  
  18. //default account constructor
  19. account();
  20.  
  21. //set each field to a empty string
  22. void Clear();
  23.  
  24. //methods for Lentext
  25. int Pack(LengthTextBuffer&) const;
  26. int UnPack(LengthTextBuffer&);
  27.  
  28. //methods for Deltext
  29. int Pack(DelimTextBuffer&) const;
  30. int UnPack(DelimTextBuffer&);
  31.  
  32. //print data
  33. void Print(ostream &);
  34.  
  35. //intializes a DelimTextBuffer to be used for Persons
  36. int InitBuffer(DelimTextBuffer &);
  37.  
  38. //intializes a LengthTextBuffer to be used for Persons
  39. int InitBuffer(LengthTextBuffer &);
  40. };

Account.cpp
  1. #include "Account.h"
  2. #include <iostream>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6.  
  7. account::account()
  8. {
  9. Clear();
  10. }
  11.  
  12. void account::Clear()
  13. {
  14. account_Number[0]=0;
  15. name[0]=0;
  16. address[0]=0;
  17. city[0]=0;
  18. state[0]=0;
  19. zip_Code[0]=0;
  20. account_Balance[0]=0;
  21. }
  22.  
  23. //pack the fields into a FixedTextBuffer
  24. //return true if all succeed
  25. int account::Pack(LengthTextBuffer & Buffer) const
  26. {
  27. int result;
  28. Buffer.Clear();
  29. result=Buffer.Pack(account_Number);
  30. result=result&&Buffer.Pack(name);
  31. result=result&&Buffer.Pack(address);
  32. result=result&&Buffer.Pack(city);
  33. result=result&&Buffer.Pack(state);
  34. result=result&&Buffer.Pack(zip_Code);
  35. result=result&&Buffer.Pack(account_Balance);
  36. return result;
  37. }
  38.  
  39. int account::UnPack(LengthTextBuffer & Buffer)
  40. {
  41. int result;
  42. result=Buffer.Unpack(account_Number);
  43. result=result&&Buffer.Unpack(name);
  44. result=result&&Buffer.Unpack(address);
  45. result=result&&Buffer.Unpack(city);
  46. result=result&&Buffer.Unpack(state);
  47. result=result&&Buffer.Unpack(zip_Code);
  48. result=result&&Buffer.Unpack(account_Balance);
  49. return result;
  50. }
  51.  
  52. //pack the fields into a FixedTextBuffer
  53. //return TRUE if all succeed, False o/w
  54. int account::Pack(DelimTextBuffer & Buffer) const
  55. {
  56. int result;
  57. Buffer.Clear();
  58. result=Buffer.Pack(account_Number);
  59. result=result&&Buffer.Pack(name);
  60. result=result&&Buffer.Pack(address);
  61. result=result&&Buffer.Pack(city);
  62. result=result&&Buffer.Pack(state);
  63. result=result&&Buffer.Pack(zip_Code);
  64. result=result&&Buffer.Pack(account_Balance);
  65. return result;
  66. }
  67.  
  68. int account::UnPack(DelimTextBuffer & Buffer)
  69. {
  70. int result;
  71. result=Buffer.Unpack(account_Number);
  72. result=result&&Buffer.Unpack(name);
  73. result=result&&Buffer.Unpack(address);
  74. result=result&&Buffer.Unpack(city);
  75. result=result&&Buffer.Unpack(state);
  76. result=result&&Buffer.Unpack(zip_Code);
  77. result=result&&Buffer.Unpack(account_Balance);
  78. return result;
  79. }
  80.  
  81. void account::Print(ostream & stream)
  82. {
  83. stream<<"Person:"
  84. <<"\t accountnumber'"<<account_Number<<"\n"
  85. <<"\t name'"<<name<<"\n"
  86. <<"\t address'"<<address<<"\n"
  87. <<"\t city'"<<city<<"\n"
  88. <<"\t state'"<<state<<"\n"
  89. <<"\t zipcode'"<<zip_Code<<"\n"
  90. <<"\t account balance'"<<account_Balance<<"\n";
  91. }


Lentext.h
  1. #ifndef CLASS_H_LENTEXT
  2. #define CLASS_H_LENTEXT
  3.  
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. //a buffer which holds length based text fields
  10. class LengthTextBuffer
  11. {
  12. public:
  13. //construct with a maximum of maxFields
  14. LengthTextBuffer(int maxBytes=1000);
  15.  
  16. //clear fields from buffer
  17. void Clear();
  18.  
  19. int Read(istream &);
  20.  
  21. int Write(ostream &) const;
  22.  
  23. //set the value of the next field of the buffer
  24. int Pack(const char *, short size=-1);
  25.  
  26. //extract the value of the next field of the buffer
  27. int Unpack(char *);
  28.  
  29. void Print(ostream &) const;
  30.  
  31. void Init(int maxBytes=1000);
  32.  
  33. private:
  34. //character array to hold field values
  35. char * Buffer;
  36.  
  37. //size of packed fields
  38. int BufferSize;
  39.  
  40. //maximum number of characters in the buffer
  41. int MaxBytes;
  42.  
  43. //packing/unpacking position in buffer
  44. int NextByte;
  45.  
  46. };
  47.  
  48. #endif

Lentext.cpp
  1. #include "Lentext.h"
  2. #include <string.h>
  3.  
  4. //constructor with a maximum of maxFields
  5. LengthTextBuffer::LengthTextBuffer(int maxBytes)
  6. {
  7. Init(maxBytes);
  8. }
  9.  
  10. //clear fields from buffer
  11. void LengthTextBuffer::Clear()
  12. {
  13. BufferSize=0;
  14. MaxBytes=0;
  15. NextByte=0;
  16. }
  17.  
  18. int LengthTextBuffer::Read(istream & stream)
  19. {
  20. Clear();
  21. stream.read((char*)&BufferSize, sizeof(BufferSize));
  22. if(stream.fail())
  23. {
  24. return false;
  25. }
  26. //buffer overflow
  27. if(BufferSize>MaxBytes)
  28. {
  29. return false;
  30. }
  31. stream.read(Buffer,BufferSize);
  32. return stream.good();
  33. }
  34.  
  35. int LengthTextBuffer::Write(ostream & stream) const
  36. {
  37. stream.write((char *)&BufferSize, sizeof(BufferSize));
  38. stream.write(Buffer, BufferSize);
  39. return stream.good();
  40. }
  41.  
  42. //set the value of the next field of the buffer
  43. //if size=-1(default) use strlen(str) as length of field
  44. int LengthTextBuffer::Pack(const char * str, short size)
  45. {
  46. //length of string to be packed
  47. size_t len;
  48. if(size>=0)
  49. {
  50. len=size;
  51. }
  52. else
  53. {
  54. len=strlen(str);
  55. }
  56. //str is too short
  57. if(len>strlen(str))
  58. {
  59. return false;
  60. }
  61. //first character to be packed
  62. int start= NextByte;
  63. NextByte += (len+sizeof(len));
  64. if(NextByte>MaxBytes)
  65. {
  66. return false;
  67. }
  68. memcpy(&Buffer[start],&len,sizeof(len));
  69. strncpy(&Buffer[start+sizeof(len)],str, len);
  70. BufferSize=NextByte;
  71. return true;
  72. }
  73.  
  74. //extract the value of the next field of buffer
  75. int LengthTextBuffer::Unpack(char * str)
  76. {
  77. //length of packed string
  78. short len;
  79. //no more fields
  80. if(NextByte>=BufferSize)
  81. {
  82. return false;
  83. }
  84. //first character to be unpacked;
  85. int start=NextByte;
  86. memcpy(&len, &Buffer[start], sizeof(short));
  87. NextByte += len +sizeof(short);
  88. if(NextByte > BufferSize)
  89. {
  90. return false;
  91. }
  92. strncpy(str, &Buffer[start+sizeof(short)],len);
  93. //zero termination for string
  94. str[len]=0;
  95. return true;
  96. }
  97.  
  98. void LengthTextBuffer::Print(ostream & stream) const
  99. {
  100. stream<< "Buffer has characters"<<MaxBytes
  101. <<" and Buffer Size " <<BufferSize<<endl;
  102. }
  103.  
  104. //construct with a maximum of maxFields
  105. void LengthTextBuffer::Init(int maxBytes)
  106. {
  107. if(maxBytes<0)
  108. {
  109. maxBytes=0;
  110. }
  111. MaxBytes=maxBytes;
  112. Buffer=new char[MaxBytes];
  113. Clear();
  114. }


Deltext.h
  1. #ifndef CLASS_H_DELTEXT
  2. #define CLASS_H_DELTEXT
  3.  
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. //a buffer which holds delimited text fields
  9. class DelimTextBuffer
  10. {
  11. public:
  12. //constructor with fields with delimeters
  13. DelimTextBuffer(char Delim='|', int maxBytes=1000);
  14. //clear fields from buffer
  15. void Clear();
  16. int Read(istream &);
  17. int Write(ostream &) const;
  18. int Pack(const char *,int size=-1);
  19. int Unpack(char *);
  20. void Print(ostream &) const;
  21. void Init(char delim, int maxBytes=1000);
  22. private:
  23. char Delim;
  24. //zero terminated string for Delim
  25. char DelimStr[2];
  26. //char array to hold field values
  27. char * Buffer;
  28. //size of packed fields
  29. int BufferSize;
  30. //maximum number of characters in the buffer
  31. int MaxBytes;
  32. //packing/unpacking position in buffer
  33. int NextByte;
  34. };
  35.  
  36. #endif

Deltext.cpp
  1. #include "Deltext.h"
  2. #include <string.h>
  3.  
  4.  
  5.  
  6. //construct with a maximum number of maxFields
  7. DelimTextBuffer::DelimTextBuffer(char Delim, int maxBytes)
  8. {
  9.  
  10. Init(Delim,maxBytes);
  11. }
  12.  
  13. //clear fields from buffer
  14. void DelimTextBuffer::Clear()
  15. {
  16. BufferSize=0;
  17. MaxBytes=0;
  18. NextByte=0;
  19. }
  20.  
  21. int DelimTextBuffer::Read(istream & stream)
  22. {
  23. Clear();
  24. stream.read((char*)&BufferSize, sizeof(BufferSize));
  25. if(stream.fail())
  26. {
  27. return false;
  28. }
  29. //buffer overflow
  30. if(BufferSize>MaxBytes)
  31. {
  32. return false;
  33. }
  34. stream.read(Buffer,BufferSize);
  35. return stream.good();
  36. }
  37.  
  38. int DelimTextBuffer::Write(ostream & stream) const
  39. {
  40. stream.write((char *)&BufferSize, sizeof(BufferSize));
  41. stream.write(Buffer, BufferSize);
  42. return stream.good();
  43. }
  44.  
  45. //set the value of the next field of the buffer
  46. //if size=-1(default) use strlen(str) as Delim of field
  47. int DelimTextBuffer::Pack(const char * str, int size )
  48. {
  49. //length of string to be packed
  50. size_t len;
  51. if(size>=0)
  52. {
  53. len=size;
  54. }
  55. else
  56. {
  57. len=strlen(str);
  58. }
  59. //str is too short
  60. if(len>strlen(str))
  61. {
  62. return false;
  63. }
  64. //first character to be packed
  65. int start=NextByte;
  66. NextByte +=len + 1;
  67. if(NextByte>MaxBytes)
  68. {
  69. return false;
  70. }
  71. memcpy(&Buffer[start],str, len);
  72. //add delimeter
  73. Buffer[start+len]=Delim;
  74. BufferSize=NextByte;
  75. return true;
  76. }
  77.  
  78. //extract the value of next field of the buffer
  79. int DelimTextBuffer::Unpack(char * str)
  80. {
  81. //length of packed string
  82. int len=-1;
  83. //first character to be unpacked
  84. int start=NextByte;
  85. for(int i=start; i<BufferSize; i++)
  86. {
  87. if(Buffer[i]==Delim)
  88. {
  89. len=i-start;
  90. break;
  91. }
  92. }
  93. //delimeter not found
  94. if(len==-1)
  95. {
  96. return false;
  97. }
  98. NextByte +=len + 1;
  99. if(NextByte>BufferSize)
  100. {
  101. return false;
  102. }
  103. strncpy(str, &Buffer[start], len);
  104. //zero termination for string
  105. str[len]=0;
  106. return true;
  107. }
  108.  
  109. void DelimTextBuffer::Print(ostream & stream) const
  110. {
  111. stream<< "Buffer has max characters" <<MaxBytes
  112. <<" and Buffer Size "<<BufferSize<<endl;
  113. }
  114.  
  115. void DelimTextBuffer::Init(char delim, int maxBytes)
  116. {
  117. Delim=delim;
  118. DelimStr[0]= Delim;
  119. DelimStr[1]=0;
  120. if(maxBytes <0)
  121. {
  122. maxBytes=0;
  123. }
  124. MaxBytes=maxBytes;
  125. Buffer= new char[MaxBytes];
  126. BufferSize=0;
  127. }
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 341
Reputation: lotrsimp12345 is an unknown quantity at this point 
Solved Threads: 2
lotrsimp12345 lotrsimp12345 is offline Offline
Posting Whiz
 
0
  #2
Dec 14th, 2009
ahhhh it won't pack.. it returns 0 which means information isn't packed. This code in my book doesn't work.
main
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include "account.h"
  5. #include "Lentext.h"
  6. #include "Deltext.h"
  7.  
  8.  
  9. using namespace std;
  10. int main()
  11. {
  12. LengthTextBuffer a;
  13. account b;
  14.  
  15. strcpy(b.account_Number,"1111111111");
  16. strcpy(b.name,"Aniket Karmarkar");
  17. strcpy(b.address,"5265 Shotkoski Dr");
  18. strcpy(b.city, "Hoffman Estates");
  19. strcpy(b.state, "IL");
  20. strcpy(b.zip_Code, "60192");
  21. strcpy(b.account_Balance, "111111");
  22. b.Print(cout);
  23. //pack data into a buffer not happening
  24. int c=b.Pack(a);
  25. cout<<endl<<c<<endl;
  26. //ofstream out;
  27. //out.open("test.txt");
  28. //a.Write(out);
  29. return 0;
  30. }
Last edited by lotrsimp12345; Dec 14th, 2009 at 7:29 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,628
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1615
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning
 
0
  #3
Dec 14th, 2009
There is no need for the pack() functionality. The account class is already packed (fixed-length). Just write the account object to a binary file.
  1. void write(Account& obj)
  2. {
  3. ofstream out("filename.dat", ios::binary | ios:: app);
  4. out.write( (char*)&obj, sizeof(Account));
  5. out.close();
  6. }

similar to read it
  1. void read(vector<Account>& accountList)
  2. {
  3. Account obj;
  4. ifstream in("filename.dat", ios::binary);
  5. while( in.read((char *)&obj, sizeof(Account))
  6. {
  7. accountList.push_back(obj);
  8. }
  9. }
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 341
Reputation: lotrsimp12345 is an unknown quantity at this point 
Solved Threads: 2
lotrsimp12345 lotrsimp12345 is offline Offline
Posting Whiz
 
0
  #4
Dec 14th, 2009
but the code in my book shows that i should pack and my teacher said I should Pack the object, then write it to the file, that way the person class and buffer class don't know anything about each other.
Last edited by lotrsimp12345; Dec 14th, 2009 at 7:37 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,628
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1615
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning
 
0
  #5
Dec 14th, 2009
You don't have to read the data back into a account class. You can do anything you want with the data, such as read it back into individual char arrays if you want to. The data file is not tied to any class or structure.

If you made the individual fields of the account class std::string instead of character arrays, then you would need to pack the data into fixed-length fields before writing them to the file. But as it is, the account class already contains fixed-length fields, such packing is not necessary. When you write a class to a data file only the data objects are written, not any of the methods.
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 341
Reputation: lotrsimp12345 is an unknown quantity at this point 
Solved Threads: 2
lotrsimp12345 lotrsimp12345 is offline Offline
Posting Whiz
 
0
  #6
Dec 14th, 2009
i don't think that is the intent of packing a buffer. IT is supposed to have a record which contains of fields and store it into a buffer everytime the all account objects assigned. The pack and send it to the buffer which does the reading and writing.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 341
Reputation: lotrsimp12345 is an unknown quantity at this point 
Solved Threads: 2
lotrsimp12345 lotrsimp12345 is offline Offline
Posting Whiz
 
0
  #7
Dec 14th, 2009
Here are my teachers directions

FILE PROCESSING - PROGRAMMING PROJECT 2
DUE: 10/28/09
This programming project is to modify the first project to be one that uses two of the buffers and the BufferFile classes outlined in the textbook in Chapter 4. The file is made of account information for a credit card company (class will be similar to project 1). To keep things simple we are only going to keep the following pieces of information about the account:

1. Account number - a 10 digit number
2. Card holder's name
3. Card holder's address which contains
* street address
* city
* state
* zip code
4. account balance

You are two write two separate programs using the buffer file class for each of the buffers chosen:
PROGRAM 1
This program is to create the file using the buffer class chosen. Your program is to be interactive with a user. You should first ask for the name of the file to be created, then create the file (in write mode). If the file cannot be created you should output an error message and quit. If the file is created then you should enter a loop that allows the user to input data into the file. Your program can use a sentinel value for the account number to exit the loop (an account number of -1 could be used).
PROGRAM2
This program is to access the file produced in program 1 and to produce a "nicely formatted" report on the contents of the file. You should be able to use the io manipulators in c++ to do formatting.
General Note:
Use the BufferFile class along with one of the Buffer classes outlined in the textbook (you can download the code from the textbook for this) for each of the programs. Note that you may need to rewrite parts of the buffer object classes because of the newer c++ standards for the language.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,628
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1615
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning
 
0
  #8
Dec 14th, 2009
The program doesn't work because the Clear() method destroys the value of MaxBytes by setting it to 0, which makes that Pack() return false when checking if size > MaxBytes.
  1. void LengthTextBuffer::Init(int maxBytes)
  2. {
  3. if(maxBytes<0)
  4. {
  5. maxBytes=0;
  6. }
  7. MaxBytes=maxBytes;
  8. Buffer=new char[MaxBytes];
  9. Clear();
  10. }
Last edited by Ancient Dragon; Dec 14th, 2009 at 8:44 pm.
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 341
Reputation: lotrsimp12345 is an unknown quantity at this point 
Solved Threads: 2
lotrsimp12345 lotrsimp12345 is offline Offline
Posting Whiz
 
0
  #9
Dec 14th, 2009
its still won't work. I don't understand why.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 341
Reputation: lotrsimp12345 is an unknown quantity at this point 
Solved Threads: 2
lotrsimp12345 lotrsimp12345 is offline Offline
Posting Whiz
 
0
  #10
Dec 14th, 2009
Here's what i have:

  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include "account.h"
  5. #include "Lentext.h"
  6. #include "Deltext.h"
  7.  
  8.  
  9. using namespace std;
  10. int main()
  11. {
  12. LengthTextBuffer a;
  13. account b;
  14.  
  15. strcpy(b.account_Number,"1111111111");
  16. strcpy(b.name,"Aniket Karmarkar");
  17. strcpy(b.address,"5265 Shotkoski Dr");
  18. strcpy(b.city, "Hoffman Estates");
  19. strcpy(b.state, "IL");
  20. strcpy(b.zip_Code, "60192");
  21. strcpy(b.account_Balance, "111111");
  22. b.Print(cout);
  23. //pack data into a buffer not happening
  24. int c=b.Pack(a);
  25. cout<<endl<<c<<endl;
  26. return 0;
  27. }
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 773 | Replies: 10
Thread Tools Search this Thread



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

©2003 - 2010 DaniWeb® LLC