memcmp(str1, "Z", 2) is a great idea to get rid of the strlen, but is harder to read or understand what's going on and why (for maintainability).
I like the strcmp because of the readability. I would use the memcmp if I did not have to add either the strlen or the memcmp(str1, "Z", 2) trick...
During a code review, I was told to change my strcmp to a memcmp, because strcmp is too expensive. I'm pretty sure he is correct, but I was wondering why. The loop gets moderate use. Here is the old code:
if (!(lWordIndex == 0 &&
strcmp(str1, "Z") == 0 ||
strcmp(str1, "X") ==...
Does anyone know why the code below compiles ok on v4r2 but does not compile on v5r1? The error msg is below the code.
It seems to require a USING clause now, when before it did not. BTW, the last else stmt passes compile, ie, you can connect without a user or pw, so the security reason does...
I seem to remember a Unix command that has an executable file as its one argument. The command displays all the references of the executable, for example: globol variables, function calls, etc...
Does anyone know of such a command? It is similar to 'ldd'.
Here is another way using a shell script
#!/bin/bash
if [ "$#" -ne 1 ] ; then
echo "USAGE: $0 file"
exit 9
fi
MASK=$(grep "ipNetmask" "$1")
if [ "$?" -ne 0 ] ; then
echo "In file does not have ipNetmask"
exit 1
fi
WORK=$(grep "ipNetwork" "$1")
if [ "$?" -ne 0 ] ; then
echo "In file...
I understand that TruUnix5.1 is a true 64 bit machine. On other machines, like solaris 8 and Aix 5.1, I can compile and link in 32 bit or 64 bit mode. I can use the "file" command to see if binaries are 32 or 64 bit. For Ex:
$ file lib/libsqlplus.so
lib/libsqlplus.so: ELF 64-bit MSB...
Add the typecast to target (see boldface below), it will work.
target=datastore.Orbit->Epoch;
target= (DS_GEP_Epoch)target + (v->epoch_number)*(sizeof(DS_GEP_Epoch));
temporary=datastore.Orbit->Epoch + ((v->epoch_number)*(sizeof(DS_GEP_Epoch)));
Yes, I tried a simple test with 'target' as a void ptr and it leterally adds one, see first listing. Then I tried it with type casting 'target' to an int and it worked, see listing 2.
/* listing 1 ---------------------------*/
#include <stdio.h>
void *target=NULL;
int *myint=NULL;
int...
My guess is that if you change target to be of type DS_GEP_Epoch, then it will work.
I base this on the rules of pointer arithmetic, like adding one to a char ptr adds sizeof(char) to the address; but adding one to a int ptr adds sizeof(int) to the address.
I'm not sure what is added to a ptr...
Client Access ODBC Driver allows you to connect to your DB2 database from your PC. For example, you can write your own software that connects to it, or you can connect to it and import DB2 tables into MS EXCEL and ACCESS. Open Excel help and type in 'odbc'.
I dont know what DB2Connect is.
If...
I tried going into strsql and doing F13. From there I select 1, change session attributes. Then, I select output to file... I do a select statement and the output goes to the file. The problem is, I dont get column names and the numeric data is garbage (being print as chars)
How do I get...
Aix and OS/400 are two different operating systems. 5.2 is the latest version (i think) of Aix and it is a flavor of Unix. V5R2 is the latest release of the OS/400 that we have. I think it's a coincidence that they both have a 5 and a 2 in the version. IBM owns both of them. The OS/400 runs...
I am trying to add a new C source file to a program. I also changed an existing source file to call functions in the new source file. All source files compile OK. The link (actually CRTSRVPGM) is complaining that:
Definition not found for symbol 'xyz'
It appears to me that CRTSVRPGM does...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.