I have modified an existing C program to process data scanned in from a 2D barcode matrix. The device used to scan is a hand held RF device that runs Windows Mobile and Telnet Client systems. It uses these to connect into our dev system that runs under Linux (Suse) operating system.
I am using the getch command to get character input from stdin standard input stream. Everything works as expected for 2D barcodes that are less than about 520 but when I scan in a 2D barcode that is over about 500 or more my program will either hang or terminate.
It will definitely terminate if I scan in a 2D barcode that is over 900 characters. It appears that it starts hanging when scanning 2D barcodes between 520 and about 800 or so and then will alwalys terminate if the 2D barcode is over 800 characters. I have tried running the C program directly from my laptop thru the linux system and I can see that it puts out the error code 114 with the message attempting to access item beyond bounds of memory.
My feeling is that the stdin input stream used by C programs to get input data may have a limit of 512 characters and if over 512 characters then memory starts to get overwritten which causes the C program to hang or terminate.
Do you know if there is a size limit on the stdin standard input stream used by C. Since 2D barcodes have a maximum of 2000 characters that could be contained at one time with a 2D matrix. All of my 2D barcodes scan successfully that are 135, 212 and 486 in character length but I have one 2D barcode from a customer that is 954 in length and it does not scan in but terminates the program when it is scanned.
On our SUSE Linux system I have used the ulimit -a linux command to find out data about memory and pipe sizes. It indicates the pipe size is set at 512 and has an 8 to the right of it. I am told by the systems people that it indicates the Linux pipe size is 512 times 8 which is 4096 in size. If this is true then the pipe size appears large enough.
I am assuming the pipe size defined on a box is what stdin is associated with from the C programming view but don't know this for sure. I have also looked up on the Internet regarding increasing a pipe size and found something on the DECC$PIPE_BUFFER_SIZE command but don't know if this can be used to increase a pipe size.
Need to know if C's stdin has a limit of 512 characters that can be processed. If so is there a way to increase the stdin size to about 1024 and can this be done thru the C system calls. Since the existing program already uses the getch command to retrieve data I don't want to change the way it is doing it.
I am assuming this issue is happening because of the large amounts of data that can be read in via the 2D barcode.
Also, would like to know if there is a way to debug and step thru a C program that runs on the SUSE linux side. I have no problem debugging on the Windows side with Micro Focus or Visual C++ but have not found anything to debug with on our Linux side. i've been adding printf statements to help in the debug process in the meantime.
Your response to these two questions would be greatly appreciated.
Thank you,
Elvin Jordan