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
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
I don't know about COBOL, can you explain what you mean with testing for low values in a field?
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]