low values

This is a discussion on low values within the C Programming forums, part of the General Programming Boards category; In COBOL you can test for low values in a field... Can you do this in C? If so, what ...

  1. #1
    Jennifer
    Guest

    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.

    Thanks,
    Jennifer

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    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
    Posts
    6,231
    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:
    Code:
    #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, 06:49 PM
  2. disposing error
    By dropper166 in forum C# Programming
    Replies: 2
    Last Post: 03-31-2009, 12:53 AM
  3. Need help with project
    By chrisa777 in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2006, 06: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21