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

Recommended Answers

All 9 Replies

So you need to generate a unique label?

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?

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?

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 print file.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.

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

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)?

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?

Open the file in append mode instead of truncuate?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.