954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

making labels with c++

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

muthuivs
Light Poster
32 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 

So you need to generate a unique label?

dwks
Posting Whiz in Training
269 posts since Nov 2005
Reputation Points: 185
Solved Threads: 28
 

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 ?

So you need to generate a unique label?
muthuivs
Light Poster
32 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 

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.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

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?

muthuivs
Light Poster
32 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 
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:\>program
Hello, World!

C:\>program >file.txt

C:\>type file.txt
Hello, World!

C:\>

Then you could printfile.txt.

Or you might be able to do this:

C:\>program >prn

or use stdprn instead of stdout.

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.

dwks
Posting Whiz in Training
269 posts since Nov 2005
Reputation Points: 185
Solved Threads: 28
 

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

muthuivs
Light Poster
32 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 
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.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)?

dwks
Posting Whiz in Training
269 posts since Nov 2005
Reputation Points: 185
Solved Threads: 28
 

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?

muthuivs
Light Poster
32 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 

Open the file in append mode instead of truncuate?

dwks
Posting Whiz in Training
269 posts since Nov 2005
Reputation Points: 185
Solved Threads: 28
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You