I use the OpenDoc6 function to open files in my app. The function accepts parameters for errors and warnings. How do I interpret the codes it passes back? The error values I see most are 0 and 2. For warnings, I see the values 2 or 3.

I use the OpenDoc6 function to open files in my app. The function accepts parameters for errors and warnings. How do I interpret the codes it passes back? The error values I see most are 0 and 2. For warnings, I see the values 2 or 3.

The returned values are a bit set which means that if one or more errors were encountered, their particular bit will be set to 1 instead of 0. Each bit represents a power or 2, so the bits are identified in decimal as 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768, and so on. Or in hexadecimal as:

0x1

0x2

0x4

0x8

0x10

0x20

0x40

0x80

0x100 and so on. In binary, the above look like this:

00000001

00000010

00000100

00001000

00010000

00100000

01000000

10000000

Notice that each value has a single bit set to one. This allows ou to combine multiple error codes into a single value. For instance, if you have code 1 and code 2, the binary representation looks like this:

00000011

which is 0x3 in hex or simple 3 in decimal. This is simply the two error codes added together (1+2).

So, in your case, an error of 2 is simply code 2, which is swFileNotFoundError and a warning of 3 is both codes 1 and 2 or swFileLoadWarning_IdMismatch and swFileLoadWarning_ReadyOnly while a warning of 2 is simply swFileLoadWarning_ReadyOnly.

A value of zero means no bits were set, so there were no errors or warnings.