Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > printint problem

Reply
Thread Tools

printint problem

 
 
grohotanie@gmail.com
Guest
Posts: n/a
 
      10-04-2007
I'm trying to print out barcodes within my program using Code128B
fonts
The code is something as follows:

strDocID = CalculateCheckSum(strDocID);
CRect rectBarcode = PrintText(pDC, rectFolder.bottom+m_nTextSpacing *
10, rect, strDocID, ALIGN_CENTER);


CString PrintContainerLabel::CalculateCheckSum(CString barcode)
{
int checkSum;
CString Code128b;

char letter;
int val = 104;
checkSum = val;

for (int i = 0; i < barcode.GetLength(); i++)
{
letter = barcode.GetAt(i);
val = letter;
val -= 32;
checkSum += val * (i + 1);
}

int moduloValue = checkSum % 103;
moduloValue += 32;

Code128b = char(202);
Code128b += barcode;
Code128b += char(moduloValue);
Code128b += char(13;

return Code128b;
}


something that I absolutely can not figure out is that it doesnt work
for "1593387" - prints out a weird character at the end of my barcode.
For any substring of this or if I add any more values, miraculously
starts working.
If anybody has any suggestions, I would greatly appreciate!
Anton

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      10-04-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I'm trying to print out barcodes within my program using Code128B
> fonts
> The code is something as follows:
>
> strDocID = CalculateCheckSum(strDocID);
> CRect rectBarcode = PrintText(pDC, rectFolder.bottom+m_nTextSpacing *
> 10, rect, strDocID, ALIGN_CENTER);
>

This looks like windows specific code which makes it OT here, you would
get better responses on a windows programming group.

--
Ian Collins.
 
Reply With Quote
 
 
 
 
Jim Langston
Guest
Posts: n/a
 
      10-04-2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> I'm trying to print out barcodes within my program using Code128B
> fonts
> The code is something as follows:
>
> strDocID = CalculateCheckSum(strDocID);
> CRect rectBarcode = PrintText(pDC, rectFolder.bottom+m_nTextSpacing *
> 10, rect, strDocID, ALIGN_CENTER);
>
>
> CString PrintContainerLabel::CalculateCheckSum(CString barcode)
> {
> int checkSum;
> CString Code128b;
>
> char letter;
> int val = 104;
> checkSum = val;
>
> for (int i = 0; i < barcode.GetLength(); i++)
> {
> letter = barcode.GetAt(i);
> val = letter;
> val -= 32;
> checkSum += val * (i + 1);
> }
>
> int moduloValue = checkSum % 103;
> moduloValue += 32;
>
> Code128b = char(202);
> Code128b += barcode;
> Code128b += char(moduloValue);
> Code128b += char(13;
>
> return Code128b;
> }
>
>
> something that I absolutely can not figure out is that it doesnt work
> for "1593387" - prints out a weird character at the end of my barcode.
> For any substring of this or if I add any more values, miraculously
> starts working.
> If anybody has any suggestions, I would greatly appreciate!
> Anton


Most likely your checksum calculation is wrong and for 1593387 it produces a
value outside of the barcode char set. Try taking a look at moduloValue for
ones printed correctly and ones with this "weird character".


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printint out a macro's expansion James H. Markowitz C Programming 3 12-26-2009 11:12 AM
Printint datagrid: last row cut Diego F. ASP .Net 0 06-08-2005 04:17 PM
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM
Photoshop Printint Problems Robert Desel Digital Photography 3 01-20-2004 07:01 AM



Advertisments