Thread: low values

  1. #1

    low values

    In COBOL you can test for low values in a field... Can you do this in C? If so, what are some recommendations? I am converting a process from COBOL / Unix to C / Unix and my input file has low values in some of the fields.


  2. #2
    Join Date
    Aug 2001
    Groningen (NL)
    I don't know about COBOL, can you explain what you mean with testing for low values in a field?

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    By low value, I presume you mean 0x00. The exact syntax of testing will depend on how you are storing your data.

    Here's a simple example:
    #include <stdio.h>
    int main(void)
    	char a[] = {0x00, 0x20, 0x00, 0x40, 0x60};
    	int i;
    	for (i = 0; i < sizeof (a); i++)
    		if (a[i] == '\0') printf ("Using '\\0', Low value at offset %d\n", i);
    		if (a[i] == 0x00) printf ("Using 0x00, Low value at offset %d\n", i);
    	return 0;
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 04-12-2009, 05:49 PM
  2. disposing error
    By dropper166 in forum C# Programming
    Replies: 2
    Last Post: 03-30-2009, 11:53 PM
  3. Need help with project
    By chrisa777 in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2006, 05:01 PM
  4. Return Values
    By Drahcir in forum C Programming
    Replies: 4
    Last Post: 03-21-2006, 12:15 AM
  5. low value, high value and increment
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 11-25-2001, 09:01 AM