Show Bid Request
small c++ program
Bid Request Id: 8546
|
|
|
Posted by: |
Brickle (4 ratings)
(Software buyer rating 10)
|
Non-action Ratio: |
Very Good - 11.11%
|
Posted: |
Feb 7, 2002 11:33:52 AM EDT
|
Bidding Closes: |
Feb 8, 2002 10:00:00 PM EDT
|
Viewed (by coders): |
505 times
|
Deadline: |
2/8/2002
TIME EXPIRED
|
|
|
|
Description:
******This program was too long to fit in the description. The rest of the code is carried over into to deliverable section.******
Using DelimTextBuffer class and
struct Book
{ char title[21], isbn[15], author[30];
};Read information about books in GSW library from file data.txt and display information about each book on the screen.
Example:
Input file:
45 Using C++ | 123456789 | Hennefeld, Burchard|
36 XML by Example | 12348989| McGrath|
On the screen:
Title: Using C++
ISBN: 123456789
Author: Hennefeld, Burchard
Title: XML by Example
ISBN: 12348989
Author: McGrath
Press any key to continue
Code for DelimTextBuffer:
class DelimTextBuffer
{ public:
DelimTextBuffer (char Delim = '|', int maxBytes = 1000);
void Clear ();
int Read (istream &);
int Write (ostream &) const;
int Pack (const char *, int size = -1);
int Unpack (char *);
void Print (ostream &) const;
int Init (char delim, int maxBytes = 1000);
private:
char Delim;
char DelimStr[2];
char * Buffer;
int BufferSize;
int MaxBytes;
int NextByte;
};DelimTextBuffer :: DelimTextBuffer (char delim, int maxBytes)
{Init (delim, maxBytes);
}void DelimTextBuffer :: Clear ()
{NextByte = 0;
BufferSize = 0;
}int DelimTextBuffer :: Read (istream & stream)
{Clear ();
stream>>BufferSize;
if (stream.fail()) return false;
if (BufferSize > MaxBytes) return false;
stream.read (Buffer, BufferSize);
return stream . good ();
}int DelimTextBuffer :: Write (ostream & stream) const
{stream<<BufferSize<<' ';
stream.write (Buffer, BufferSize);
return stream.good ();
}int DelimTextBuffer :: Pack (const char * str, int size)
// set the value of the next field of the buffer;
// if size = -1 (default) use strlen(str) as Delim of field
{short len; // length of string to be packed
if (size >= 0) len = size;
else len = strlen (str);
if (len > strlen(str)) // str is too short!
return false;
int start = NextByte; // first character to be packed
NextByte += len + 1;
if (NextByte > MaxBytes) return false;
memcpy (&Buffer[start], str, len);
Buffer [start+len] = Delim; // add delimeter
BufferSize = NextByte;
return true;
}int DelimTextBuffer :: Unpack (char * str)
// extract the value of the next field of the buffer
{int len = -1; // length of packed string
int start = NextByte; // first character to be unpacked
for (int i = start; i < BufferSize; i++)
if (Buffer[i] == Delim)
{len = i - start; break;}
if (len == -1) return false; // delimeter not found
Deliverables: NextByte += len + 1; if (NextByte > BufferSize) return false; strncpy (str, &Buffer[start], len); str [len] = 0; // zero termination for string return true; }void DelimTextBuffer :: Print (ostream & stream) const {stream << "Buffer has max characters " << MaxBytes << " and Buffer Size " << BufferSize << endl; }// Protected members int DelimTextBuffer :: Init (char delim, int maxBytes) // construct with a maximum of maxFields {Delim = delim; DelimStr[0] = Delim; DelimStr[1] = 0; if (maxBytes < 0) maxBytes = 0; MaxBytes = maxBytes; Buffer = new char[MaxBytes]; BufferSize = 0; return 1;}
Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
Complete copyrights to all work purchased.
Platform:
Visual C++
Must be 100% finished and received by buyer on:
Feb 8, 2002 EDT
Deadline legal notes: All times are expressed in the time zone of the site EDT (UT - 5). If the buyer omitted a time, then the deadline is 11:59:59 PM EDT on the indicated date.
Special Conditions / Other:
Must have by 10pm on Friday Feb 8, 2002 usa EST
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$15 (USD)
|
Feb 7, 2002 12:51:49 PM EDT
|
10
(Excellent)
|
|
|
Hello Sir
I have extensively worked on C++/VC++. The code is ready with me already. You can have it anytime Sir. :-)!
Waiting for a positive response.
Regards, Sumegha |
|
|
|
|
N/A
|
Feb 7, 2002 10:10:28 PM EDT
|
10
(Excellent)
|
|
|
Hello Sir
this is the executable. You should have the exe and the input data file in the same folder to view the results.
Take care, Sumegha |
|
Attached File
|
|
|
|
|