943,946 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 6377
  • C++ RSS
Feb 2nd, 2006
0

making labels with c++

Expand Post »
I have the logic all figured out for a nes program that will spit out labels with unique charactrs on it...Almost like barcodes, but nothing that fancy. My stickers will have something like this: ABCGIU101.DFF

Like I said, I have the logic but I am not sure how to start the project with C++ since I dont want to out put to word and print from there. I want my program to be self sustaining. Any suggestions on how to print out a series of these labels using c++. Can I output to a text file and print from there ? That would be OK for me.

Wow, pretty soon i might actually become a programmer with all this little projects.

MuthuIVS
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
muthuivs is offline Offline
32 posts
since Jan 2006
Feb 4th, 2006
0

Re: making labels with c++

So you need to generate a unique label?
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005
Feb 5th, 2006
0

Re: making labels with c++

Yes, I know how to generate the unique numbers, just not sure where to spit out the results so that they can be printed out using AVERY-5167 labels. Would I be able to output to a text file perhaps? and if i did would the formatting for a txt file be the same pc to pc ?


Quote originally posted by dwks ...
So you need to generate a unique label?
Reputation Points: 10
Solved Threads: 0
Light Poster
muthuivs is offline Offline
32 posts
since Jan 2006
Feb 6th, 2006
0

Re: making labels with c++

Take a look at the C++ code snippet at
http://www.daniweb.com/code/snippet122.html

You will have to format your text to fit the labels.
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Feb 9th, 2006
0

Re: making labels with c++

Quote originally posted by vegaseat ...
Take a look at the C++ code snippet at
http://www.daniweb.com/code/snippet122.html

You will have to format your text to fit the labels.
I don't understand the code, It there a way to just print out to the usb printer since I have the output all trimmed for the label?
Reputation Points: 10
Solved Threads: 0
Light Poster
muthuivs is offline Offline
32 posts
since Jan 2006
Feb 9th, 2006
0

Re: making labels with c++

Quote ...
It there a way to just print out to the usb printer
The easiest way to do that would be to redirect the output of your program into a file, and then print that file:
C++ Syntax (Toggle Plain Text)
  1. C:\>program
  2. Hello, World!
  3.  
  4. C:\>program >file.txt
  5.  
  6. C:\>type file.txt
  7. Hello, World!
  8.  
  9. C:\>
Then you could print file.txt.

Or you might be able to do this:
C++ Syntax (Toggle Plain Text)
  1. C:\>program >prn
or use stdprn instead of stdout.
C++ Syntax (Toggle Plain Text)
  1. fprintf(stdprn, "Hello, World!\n");
Your best bet would be to redirect the output of your program into a file, and then print that file with some other program. Everything else I've shown you here might not work, but that definitely will.
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005
Feb 9th, 2006
0

Re: making labels with c++

The only problem about rpinting from a txt file is that I cannot get the labels to line up. I have already tried this, but the endl (endline) characheter is too wide, and txt files do not allow me change that setting. Also the fonts have to be in Even numbers withour decimals, that is also making it hard for me to get it to fit perfectly into a 80 label sheet (20*4).

MuthuIVS
Reputation Points: 10
Solved Threads: 0
Light Poster
muthuivs is offline Offline
32 posts
since Jan 2006
Feb 9th, 2006
0

Re: making labels with c++

Quote ...
the endl (endline) characheter is too wide
You can only print 79 chars on the screen on one line if you print a newline too. Try re-doing your formatting.
Quote ...
Also the fonts have to be in Even numbers withour decimals, that is also making it hard for me to get it to fit perfectly into a 80 label sheet (20*4).
What do you mean? Are you printing in a monospaced font (like Courier New)?
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005
Feb 10th, 2006
0

Re: making labels with c++

I think I am doing everything right because I am making sure I am not stuffing toomany info on 1 line and so on. I am now trying to print the output to a RTF template that will defintely work but once my program writes to it , the formatting in the RTF is all deleted. Any Idea how to get around that?
Reputation Points: 10
Solved Threads: 0
Light Poster
muthuivs is offline Offline
32 posts
since Jan 2006
Feb 10th, 2006
0

Re: making labels with c++

Open the file in append mode instead of truncuate?
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Number of times a number appears in an array
Next Thread in C++ Forum Timeline: Trying to use c++ to print to a usb printer





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC