473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to format output to look like barcode

hey readers, can you please tell me how to write a c program which looks something like this.

./task.c
part 1Enter barcode (input): 9300605048577

part 2 prints:- Barcode is 930-060504-857-7

i know how to do part 1 but i need help with part 2. how can i make the inputed barcode print like shown above in part 2.
thx
Mar 12 '10 #1
7 2220
whodgson
542 512MB
what controls the position of the - operator?
Mar 12 '10 #2
donbock
2,426 Expert 2GB
Convert your example input into your example output with pencil and paper. How did you do it?
Mar 12 '10 #3
i am talking about doing this in C complier. i cant use any strings etc. its just integers.
Mar 13 '10 #4
jkmyoung
2,057 Expert 2GB
What donbock really means is: Give us the algorithm. We don't know about the format of your barcode so we're liable to come up with something like:
9-30060504857-7 or
9300-6050-4857-7 or
9300-60504-8577

You're going to have problems, if you can't use strings. The maximum value most compliers take for an int is 4294967296, which is significantly smaller.

I suggest you either read it character by character, or as a string line.
Mar 15 '10 #5
donbock
2,426 Expert 2GB
I would like you to try this with pencil and paper for a few cases. Doing so should make the necessary algorithm obvious. Then you can write your C code.
Mar 15 '10 #6
ok i did it on paper, but i think i have a problem typing the right commands.
and buy the way i can use long integer to input and processes longer numbers.
i prefer to use basic operators while writing this program, cant use string, arrays or functions.
Mar 15 '10 #7
jkmyoung
2,057 Expert 2GB
Is it possible for you to type out the work? Help us, help you.

You probably need a modulus operator. %

Eg. Take long num = 123456,
To get 12:
num / 10000;
To get 3:
(num / 1000) % 10;
To get 45:
(num /10) % 100;
Mar 16 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Kyle | last post by:
I need to take text from a database, turn it into a barcode from the Web and print to a Zebra Z4M barcode printer. I am stuck at two separate approaches. 1. Use ZPL II (Zebra's proprietary...
1
by: Query Builder | last post by:
I am new to BCP. Can anyone help me understand this? I tried searching the BOL but it doesnt show much help on syntex. Lets say I have a simple table and want to out put the records into a file....
3
by: Tom Turner | last post by:
Here's the background on my situation. The question follows --- We have 600 units of mail going from our business to various Post Offices every morning. Every unit is accompanied by a paper...
1
by: Aaron Bronow | last post by:
I have an asp.net application which loads a Crystal Reports ReportDocument, passes in parameters for selecting data from the report's database connection, renders the report for previewing on the...
16
by: Al Reid | last post by:
First, I'm using vb2005. I have a string that is read from a barcode reader into a TextBox. The string is 6 characters long and represents a date (mmddyy). I want to display it to the user in a...
6
by: Samuel Shulman | last post by:
I would like to add barcode functionality to my POS program How does one attach barcode reader is it usually USB port How can the program get the data read by the device Thank you, Samuel
7
by: Alper Ozgur | last post by:
Hi; How can i capture and decode the barcode that reading by an usb Barcode reader?
2
by: nmrpa91290 | last post by:
Hi, I am in the design phase of building a database that will track the productivity of my warehouse. I am thinking of using a barcode scanner to assist me with this. Employees will hopefully...
3
by: suresh_nsnguys | last post by:
Hi guys, i am planning to create 1 barcode that will display in both PC and also mobile phone.i tried out using code-39 using php .but its not getting fit in mobile screen , the user...
2
by: sam | last post by:
can someone show how to change print font width & heigh scaling? I am writing a code for barcode printing on smaller label. I do not want change font size, because this may cause the bar code...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.