473,394 Members | 1,701 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,394 software developers and data experts.

How to add an ENTER or CRLF to this Barcode

First let me say that I am not a C programmer. I have a small piece of
code used in a hand held data collector. Its purpose is to pad zeros
to the front of a scanned barcode so its length is 14 char. What I
want is for an ENTER to be suffixed so the user does not have to press
the Enter button after the scan and padding. If anyone can help me I
would be very appreciative.

char buf[16];

void _PadZero_3()
{
unsigned n;
int pos, row;

n = strlen(_CountUpc_F01);
if (n <14){
pos = _get_cursor();
row = ((pos >8) & 0xff) - 1;
sprintf(buf, "%014s", _CountUpc_F01);
strcpy(_CountUpc_F01, buf);
_set_cursor(row, 0);
printf("%s\n", _CountUpc_F01);
}
}

Nov 18 '06 #1
4 3214
Joyrider wrote:
First let me say that I am not a C programmer. I have a small piece of
code used in a hand held data collector. Its purpose is to pad zeros
to the front of a scanned barcode so its length is 14 char. What I
want is for an ENTER to be suffixed...
You want ENTER (by which I assume you mean \n)
to be suffixed to what ?
...so the user does not have to press
the Enter button after the scan and padding. If anyone can help me I
would be very appreciative.

char buf[16];

void _PadZero_3()
{
unsigned n;
int pos, row;

n = strlen(_CountUpc_F01);
if (n <14){
pos = _get_cursor();
row = ((pos >8) & 0xff) - 1;
sprintf(buf, "%014s", _CountUpc_F01);
I'm not sure this is legal ; the 0 flag doesn't work
with s.
strcpy(_CountUpc_F01, buf);
_set_cursor(row, 0);
printf("%s\n", _CountUpc_F01);
}
}
Nov 19 '06 #2
Send an Enter after _CountUPC_F01. I thought it could be part of this
variable, but again, I am not a programmer.

Spiros Bousbouras wrote:
Joyrider wrote:
First let me say that I am not a C programmer. I have a small piece of
code used in a hand held data collector. Its purpose is to pad zeros
to the front of a scanned barcode so its length is 14 char. What I
want is for an ENTER to be suffixed...

You want ENTER (by which I assume you mean \n)
to be suffixed to what ?
...so the user does not have to press
the Enter button after the scan and padding. If anyone can help me I
would be very appreciative.

char buf[16];

void _PadZero_3()
{
unsigned n;
int pos, row;

n = strlen(_CountUpc_F01);
if (n <14){
pos = _get_cursor();
row = ((pos >8) & 0xff) - 1;
sprintf(buf, "%014s", _CountUpc_F01);

I'm not sure this is legal ; the 0 flag doesn't work
with s.
This is working code.
>
strcpy(_CountUpc_F01, buf);
_set_cursor(row, 0);
printf("%s\n", _CountUpc_F01);
}
}
Nov 19 '06 #3
Joyrider wrote:
Send an Enter after _CountUPC_F01. I thought it could be part of this
variable, but again, I am not a programmer.
Enter is a key not a character. If by Enter you
mean a newline sequence then the statement
printf("%s\n", _CountUpc_F01) already does
that. What makes you think that it doesn't ?
Spiros Bousbouras wrote:
Joyrider wrote:
char buf[16];
>
void _PadZero_3()
{
unsigned n;
int pos, row;
>
n = strlen(_CountUpc_F01);
if (n <14){
pos = _get_cursor();
row = ((pos >8) & 0xff) - 1;
sprintf(buf, "%014s", _CountUpc_F01);
I'm not sure this is legal ; the 0 flag doesn't work
with s.

This is working code.
Undefined behaviour is consistent with "working" code.

Nov 19 '06 #4
In article <11**********************@h48g2000cwc.googlegroups .com>,
Joyrider <rl*******@shaw.cawrote:
>I have a small piece of
code used in a hand held data collector. Its purpose is to pad zeros
to the front of a scanned barcode so its length is 14 char. What I
want is for an ENTER to be suffixed so the user does not have to press
the Enter button after the scan and padding.
Do I understand correctly that there is some kind of forms processing
going on, and after you fill in that field of the form, you want to
trigger the forms input routine for that field, as if the user had
typed in the value and triggered the input routine themselves?

If that is the case, then there is no way in Standard C to do that.
Standard C can create output, but arranging for that output to trigger
input is beyond the specifications of C itself.

There might be ways available through the facilities provided by
your forms package, but you would have to check a newsgroup or
source more familiar with that package to find out.

It is not the ENTER or return itself that concerns you, right? It is
the action that ENTER or return would trigger that you want to
trigger, right?

Some forms packages have no way of doing this. Others rely on hacks
like telling the output device to program the "answerback" sequence
and then sending a "who are you" request to get the device to emit
that string as if the user had entered it. Others rely upon
"synthetic key presses" being generated. Lots of different ways,
most of them ugly and a pain to use.
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell
Nov 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom | last post by:
Using VB6, I want to read barcode data into an Access 2000 DB. What do you get when you read a barcode? Text or numbers. How do you define the field were the data would be stored? Thanks in...
5
by: Rajani | last post by:
I have tickets printed with barcode. When i scan that code is placed in a text box of my form. How can i read from the scanner and put it in a specific text box? Or i directly want to insert...
4
by: McKirahan | last post by:
How would I use a regular expression to remove all trailing Carriage Returns and Line Feeds (%0D%0A) from a textarea's value? Thanks in advance. Also, are they any great references for learning...
5
by: McKirahan | last post by:
I'd like to use regular expressions to remove extraneous Carriage Return Line Feeds (CrLf) from a textarea before the form is submitted. I'd like to remove all trailing CrLf's and convert all...
1
by: kgerritsen | last post by:
I am building an application that will receive input from a barcode scanner. The barcode scanner is configured to append to the front value a single character and hyphen that identify the barcode...
7
by: Alper Ozgur | last post by:
Hi; How can i capture and decode the barcode that reading by an usb Barcode reader?
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: Stevecbl | last post by:
Hello, I have an application that works on a PPC 2003 device but causes a slight problem on a WM 5.0 device. These devices are equipt with barcode scanners. The problem that I am seeing is that...
5
by: id10t error | last post by:
I have a program where were are scanning bar codes for a scanner hooked up to a laptop via USB. The scanner adds the CRLF at the end of every scan. I need to figure out how to make the program to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.