473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Struggling with bsearch - on a struct!

Hello

I have received a lot of help on my little project here. Many thanks.

I have a struct with a string and a long member. I have worked out how to
qsort the struct on both members. I can do a bsearch on the long member
(nKey) but I am struggling to do a search using the string member.

The code I am running appears below. It doesn't crash or anything. It is
just that when I do the last bsearch using "192.168.1.3" I SHOULD find the
item with nKey: 7.

Any help would be MUCH appreciated.
#include <stdio.h>
#include <string.h>
#include <search.h>
struct mystruct
{
long nKey;
char szIP[20];
};
int compare( const void *val1, const void *val2 );
int IPcompare( const void* arg1, const void* arg2 );
int main()
{
mystruct devlist[4];
devlist[0].nKey = 9;
strcpy(devlist[0].szIP, "192.168.1.1");
devlist[1].nKey = 2;
strcpy(devlist[1].szIP, "192.168.1.2");
devlist[2].nKey = 7;
strcpy(devlist[2].szIP, "192.168.1.3");
devlist[3].nKey = 1;
strcpy(devlist[3].szIP, "192.168.1.4");
printf("Values before qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP, devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP, devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP, devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP, devlist[3].nKey);
qsort( (void *)devlist, (size_t)4, sizeof( mystruct ), compare );
// Now print out - see if anything change
printf("Values after qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP, devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP, devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP, devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP, devlist[3].nKey);

// Now lets qsort by IP Address
qsort( (void *)devlist, (size_t)4, sizeof( mystruct ), IPcompare );
printf("Values after IP Address qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP, devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP, devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP, devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP, devlist[3].nKey);

const long nKey = 2L;
// Looking for IP by Key
printf("Looking for an IP address by key (DeviceID) - Search where nKey =
2\n");
mystruct* rr = (mystruct*) bsearch(&nKey, devlist, 4, sizeof(mystruct),
compare );
if( rr )
printf( "IP address: %s found (searched using key %u\n", rr->szIP,
rr->nKey );
else
printf( "IP Address not found!\n" );

printf("Now we look for a a key (DeviceID) by IP address - search on
192.168.1.3\n");
const char* szIP = "192.168.1.3";
// key, base search data, num, width, cmp_func
mystruct* fnd = (mystruct*) bsearch(&szIP, devlist, 4, sizeof(mystruct),
IPcompare ); // This line not working!!!
if( fnd )
printf( "nKey: %u found (searched using %s\n", fnd->nKey, fnd->szIP );
else
printf( "nKey NOT found!\n" );
return 0;
}
int compare( const void* val1, const void* val2 )
{
struct mystruct* sp1 = (mystruct*)val1;
struct mystruct *sp2 = (mystruct*)val2;
return (int)(sp1->nKey - sp2->nKey);
}
int IPcompare( const void* arg1, const void* arg2 ) // char **arg1, char
**arg2 )
{
/* Compare all of both strings: */
struct mystruct *sp1 = (mystruct*)arg1;
struct mystruct *sp2 = (mystruct*)arg2;
return _strcmpi( sp1->szIP, sp2->szIP );
}

The output I get is:

Values before qsort
Item 0, IP: 192.168.1.1, Key: 9
Item 1, IP: 192.168.1.2, Key: 2
Item 2, IP: 192.168.1.3, Key: 7
Item 3, IP: 192.168.1.4, Key: 1
Values after qsort
Item 0, IP: 192.168.1.4, Key: 1
Item 1, IP: 192.168.1.2, Key: 2
Item 2, IP: 192.168.1.3, Key: 7
Item 3, IP: 192.168.1.1, Key: 9
Values after IP Address qsort
Item 0, IP: 192.168.1.1, Key: 9
Item 1, IP: 192.168.1.2, Key: 2
Item 2, IP: 192.168.1.3, Key: 7
Item 3, IP: 192.168.1.4, Key: 1
Looking for an IP address by key (DeviceID) - Search where nKey = 2
IP address: 192.168.1.2 found (searched using key 2
Now we look for a a key (DeviceID) by IP address - search on 192.168.1.3
nKey NOT found!
Press any key to continue

Nov 14 '05 #1
4 5553

"Angus Comber" <an***@iteloffice.com.PLEASENOSPAM> wrote in message
const char* szIP = "192.168.1.3";
// key, base search data, num, width, cmp_func
mystruct* fnd = (mystruct*) bsearch(&szIP, devlist, 4, sizeof(mystruct),
IPcompare ); // This line not working!!! int IPcompare( const void* arg1, const void* arg2 ) // char **arg1, char
**arg2 )
{
/* Compare all of both strings: */
struct mystruct *sp1 = (mystruct*)arg1;
struct mystruct *sp2 = (mystruct*)arg2;
return _strcmpi( sp1->szIP, sp2->szIP );
}

You are passing bsearch() a char **, but the comparison function is
expecting two mystruct *s.
What you need to do is make a temporary mystruct

mystruct comp;
comp.szIP = szIP;
bsearch(&comp ... );
Nov 14 '05 #2
Angus Comber wrote:
Hello

I have received a lot of help on my little project here. Many thanks.

I have a struct with a string and a long member. I have worked out how to
qsort the struct on both members. I can do a bsearch on the long member
(nKey) but I am struggling to do a search using the string member.

The code I am running appears below. It doesn't crash or anything. It is
just that when I do the last bsearch using "192.168.1.3" I SHOULD find the
item with nKey: 7.

Any help would be MUCH appreciated.
#include <stdio.h>
#include <string.h>
#include <search.h>
This is not a standard header.
struct mystruct
{
long nKey;
char szIP[20];
};
int compare( const void *val1, const void *val2 );
int IPcompare( const void* arg1, const void* arg2 );
int main()
Better: int main(void)
{
mystruct devlist[4];
Syntax error. Should be:

struct mystruct devlist[4];
devlist[0].nKey = 9;
strcpy(devlist[0].szIP, "192.168.1.1");
devlist[1].nKey = 2;
strcpy(devlist[1].szIP, "192.168.1.2");
devlist[2].nKey = 7;
strcpy(devlist[2].szIP, "192.168.1.3");
devlist[3].nKey = 1;
strcpy(devlist[3].szIP, "192.168.1.4");
Why not:

struct mystruct devlist[] =
{
{ 9, "192.168.1.1" },
{ 2, "192.168.1.2" },
{ 7, "192.168.1.3" },
{ 1, "192.168.1.4" }
};
size_t n = sizeof devlist / sizeof devlist[0];
size_t i;
printf("Values before qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP, devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP, devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP, devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP, devlist[3].nKey);
Undefined behaviour (%u expects unsigned int, not signed long).

for(i = 0; i < n; i++)
{
printf("Item %u, IP: %s, Key: %ld\n",
(unsigned)i,
devlist[i].szIP,
devlist[0].nKey);
}

qsort( (void *)devlist, (size_t)4, sizeof( mystruct ), compare );
qsort(devlist, n, sizeof devlist[0], compare);
// Now print out - see if anything change
printf("Values after qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP, devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP, devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP, devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP, devlist[3].nKey);
Or just:

for(i = 0; i < n; i++)
{
printf("Item %u, IP: %s, Key: %ld\n",
(unsigned)i,
devlist[i].szIP,
devlist[0].nKey);
}
// Now lets qsort by IP Address
qsort( (void *)devlist, (size_t)4, sizeof( mystruct ), IPcompare );
qsort(devlist, n, sizeof devlist[0], IPcompare);
printf("Values after IP Address qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP, devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP, devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP, devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP, devlist[3].nKey);
for(i = 0; i < n; i++)
{
printf("Item %u, IP: %s, Key: %ld\n",
(unsigned)i,
devlist[i].szIP,
devlist[0].nKey);
}
const long nKey = 2L;
Are you using a C99 compiler? If so, which one? If not, defining a new
object here is an error.
// Looking for IP by Key
printf("Looking for an IP address by key (DeviceID) - Search where nKey =
2\n");
mystruct* rr = (mystruct*) bsearch(&nKey, devlist, 4, sizeof(mystruct),
compare );
No no no. Look, firstly, you've got the array sorted by IP address, so
there's no earthly point in looking for an nKey using bsearch(). Secondly,
you've included an utterly spurious cast which masks the very significant
error of having failed to #include <stdlib.h> - and thirdly, you did
another of them thar defining variables halfway down your code.

If you want to search for an nKey, do it like this.

1) at the top somewhere:

#include <stdlib.h>

2) at the top somewhere, define:

struct mystruct Key = {0};
struct mystruct *rr = NULL;

3) back down here again, make sure it's sorted by nKey:

qsort(devlist, n, sizeof devlist[0], compare);

4) Set up the key you're looking for:

Key.nKey = 2L;

5) Now we can bsearch:

rr = bsearch(&Key, devlist, n, sizeof devlist[0], compare);

/* If that line gives you a diagnostic, make sure you have <stdlib.h>
included. If it /still/ gives you a diagnostic, choose whether you want to
write C or C++. If you wish to write C, use a C compiler, not a C++
compiler. */

if(rr != NULL)
{
/* you found one! */

if( rr )
printf( "IP address: %s found (searched using key %u\n", rr->szIP,
rr->nKey );
else
printf( "IP Address not found!\n" );

printf("Now we look for a a key (DeviceID) by IP address - search on
192.168.1.3\n");
This time, we want to search the other way, so first we must sort the other
way:

qsort(devlist, n, sizeof devlist[0], IPcompare);

const char* szIP = "192.168.1.3";
No, let's just:

strcpy(Key.szIP, "192.168.1.3");

// key, base search data, num, width, cmp_func
mystruct* fnd = (mystruct*) bsearch(&szIP, devlist, 4, sizeof(mystruct),
IPcompare ); // This line not working!!!
rr = bsearch(&Key, devlist, n, sizeof devlist[0], IPcompare);

if(rr != NULL)
{
/* found! */
if( fnd )
printf( "nKey: %u found (searched using %s\n", fnd->nKey, fnd->szIP );
else
printf( "nKey NOT found!\n" );
return 0;
}
int compare( const void* val1, const void* val2 )
{
struct mystruct* sp1 = (mystruct*)val1;
struct mystruct *sp2 = (mystruct*)val2;
return (int)(sp1->nKey - sp2->nKey);
}
int compare(const void *val1, const void *val2)
{
const struct mystruct *sp1 = val1;
const struct mystruct *sp2 = val2;
return sp1->nKey < sp2->nKey ? -1 : sp1->nKey > sp2->nKey;
}
int IPcompare( const void* arg1, const void* arg2 ) // char **arg1, char
**arg2 )
{
/* Compare all of both strings: */
struct mystruct *sp1 = (mystruct*)arg1;
struct mystruct *sp2 = (mystruct*)arg2;
return _strcmpi( sp1->szIP, sp2->szIP );
}


int IPcompare(const void *arg1, const void *arg2)
{
const struct mystruct *sp1 = arg1;
const struct mystruct *sp2 = arg2;
return strcmp(sp1->szIP, sp2->szIP);
}

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #3
nrk
Angus Comber wrote:
Hello

I have received a lot of help on my little project here. Many thanks.

I have a struct with a string and a long member. I have worked out how to
qsort the struct on both members. I can do a bsearch on the long member
(nKey) but I am struggling to do a search using the string member.

The code I am running appears below. It doesn't crash or anything. It is
just that when I do the last bsearch using "192.168.1.3" I SHOULD find the
item with nKey: 7.

Any help would be MUCH appreciated.


<Atrociously indented code snipped>

Here's your code (indented, and long lines broken, but otherwise unchanged),
so that humans can make some sense out of it, along with comments:

#include <stdio.h>
#include <string.h>
#include <search.h>
Non-standard header. You definitely want stdlib.h as that's where you get
declarations for qsort and bsearch. So remove this, and insert:
#include <stdlib.h>

struct mystruct
{
long nKey;
char szIP[20];
};

int compare( const void *val1, const void *val2 );
int IPcompare( const void* arg1, const void* arg2 );

int main() {
mystruct devlist[4];

devlist[0].nKey = 9;
strcpy(devlist[0].szIP, "192.168.1.1");
devlist[1].nKey = 2;
strcpy(devlist[1].szIP, "192.168.1.2");
devlist[2].nKey = 7;
strcpy(devlist[2].szIP, "192.168.1.3");
devlist[3].nKey = 1;
strcpy(devlist[3].szIP, "192.168.1.4");

printf("Values before qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP,
devlist[0].nKey);

%u is for unsigned int. Since nKey is a long, why not use %ld?

printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP,
devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP,
devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP,
devlist[3].nKey);

qsort( (void *)devlist, (size_t)4, sizeof( mystruct ), compare );

You don't need that cast to void *. Nor the cast to size_t. Get rid of
them both. Also, instead of hardcoding the 4, you can say:

qsort(devlist, sizeof devlist/sizeof devlist[0], sizeof(devlist[0]),
compare);

// Now print out - see if anything change
printf("Values after qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP,
devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP,
devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP,
devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP,
devlist[3].nKey);

// Now lets qsort by IP Address
qsort( (void *)devlist, (size_t)4, sizeof( mystruct ), IPcompare );

This qsort can also be similarly rewritten.

printf("Values after IP Address qsort\n");
printf("Item %u, IP: %s, Key: %u\n", 0, devlist[0].szIP,
devlist[0].nKey);
printf("Item %u, IP: %s, Key: %u\n", 1, devlist[1].szIP,
devlist[1].nKey);
printf("Item %u, IP: %s, Key: %u\n", 2, devlist[2].szIP,
devlist[2].nKey);
printf("Item %u, IP: %s, Key: %u\n", 3, devlist[3].szIP,
devlist[3].nKey);

const long nKey = 2L;
// Looking for IP by Key
printf("Looking for an IP address by key (DeviceID) - Search where nKey"
" = 2\n");
mystruct* rr = (mystruct*) bsearch(&nKey, devlist, 4, sizeof(mystruct),
compare );

Read the description of bsearch carefully. Particularly, what it expects
from the compare function. Here's what my man page says:

The compar routine is expected to have two arguments which point to the key
object and to an array member, in that order, and should return an
integer less than, equal to, or greater than zero if the key object is
found, respectively, to be less than, to match, or be greater than the
array member.

Notice the parameters to the compare function. The first is a pointer to
the key object, and the second to an array member. Your array members are
all struct mystruct. But your key object is a const long!! However, your
compare function expects the key object to also be a struct mystruct.
What's the solution? Write a new compare function and use that instead:

int srchcmp_nKey(const void *keyp, const void *memp) {
const long *key = keyp;
const struct mystruct *mem = memp;

return (*key < mem->nKey) ? -1 : (*key > mem->nKey);
}

Also, there is no need to cast the returned void * from bsearch. One
important thing that you've failed to notice here is that your second qsort
re-sorts the array based on the szIP field. Since it is no longer sorted
on the nKey field, the results of the bsearch are meaningless. If you find
your key, well and good. But if you don't, there's no guarantee that the
key is not present, since your array wasn't sorted in key order. Having
the array sorted in key order is a pre-condition for bsearch to give
meaningful results.

if( rr )
printf( "IP address: %s found (searched using key %u\n", rr->szIP,
rr->nKey );
else
printf( "IP Address not found!\n" );

printf("Now we look for a a key (DeviceID) by IP address - search on"
" 192.168.1.3\n");
const char* szIP = "192.168.1.3";
// key, base search data, num, width, cmp_func
mystruct* fnd = (mystruct*) bsearch(&szIP, devlist, 4, sizeof(mystruct),
IPcompare );

Again, problem with the compare function. Also note that szIP already is a
pointer to the string that you want to act as the key. You don't need to
pass &szIP. Just pass szIP.

mystruct *fnd = bsearch(szIP, devlist, sizeof devlist/sizeof devlist[0],
sizeof devlist[0], srchcmp_szIP);

and here's the compare function:

int srchcmp_szIP(const void *keyp, const void *memp) {
const char *key = keyp;
const struct mystruct *mem = memp;

return strcmp(keyp, mem->szIP);
}

Since it is IP addresses that your comparing, why waste cycles doing a case
independent compare? Simply do a straight string compare.

if( fnd )
printf("nKey: %u found (searched using %s\n", fnd->nKey, fnd->szIP);
else
printf( "nKey NOT found!\n" );
return 0;
}
int compare( const void* val1, const void* val2 )
{
struct mystruct* sp1 = (mystruct*)val1;
struct mystruct *sp2 = (mystruct*)val2;
return (int)(sp1->nKey - sp2->nKey);
}

int IPcompare( const void* arg1, const void* arg2 )
{
/* Compare all of both strings: */
struct mystruct *sp1 = (mystruct*)arg1;
struct mystruct *sp2 = (mystruct*)arg2;
return _strcmpi( sp1->szIP, sp2->szIP );

That's a non-standard function. There seems to be no real need to use one
here.

}

HTH,
-nrk.

ps: If you used tabs to intend your code, convert them to spaces before
posting it on usenet. Many newsreaders and servers don't handle tabs all
that well.

--
Remove devnull for email
Nov 14 '05 #4


Angus Comber wrote:
Hello

I have received a lot of help on my little project here. Many thanks.

I have a struct with a string and a long member. I have worked out how to
qsort the struct on both members. I can do a bsearch on the long member
(nKey) but I am struggling to do a search using the string member.

The code I am running appears below. It doesn't crash or anything. It is
just that when I do the last bsearch using "192.168.1.3" I SHOULD find the
item with nKey: 7.

Unless there is a correlation (and there doesn't appear to be one with
your data), you should not sort by the key and the bsearch by the IP, or
vise versa. If the sort the array of structs by the key, then you need
to search by a key. And, if you sort by the IP, you need to search by
the IP.

To correct this problem and other errors in your code:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct mystruct
{
long nKey;
char szIP[20];
};

int compare( const void *val1, const void *val2 );
int IPcompare( const void* arg1, const void* arg2 );

int main(void)
{
int i;
struct mystruct devlist[4], tmp, *fnd;
devlist[0].nKey = 9;
strcpy(devlist[0].szIP, "192.168.1.1");
devlist[1].nKey = 2;
strcpy(devlist[1].szIP, "192.168.1.2");
devlist[2].nKey = 7;
strcpy(devlist[2].szIP, "192.168.1.3");
devlist[3].nKey = 1;
strcpy(devlist[3].szIP, "192.168.1.4");
puts("Values before qsort");
for(i = 0; i < 4;i++)
printf("Item %d, IP: %s, Key: %ld\n", i, devlist[i].szIP,
devlist[i].nKey);
/* sort by key */
qsort( devlist, 4, sizeof *devlist, compare );
puts("Values after qsort by key");
for(i = 0; i < 4;i++)
printf("Item %d, IP: %s, Key: %ld\n", i, devlist[i].szIP,
devlist[i].nKey);
/* search by key */
tmp.nKey = 2;
if((fnd = bsearch(&tmp,devlist,4,sizeof *devlist,
compare)) != NULL)
printf("The key %ld was found, and the Ip is %s\n",
fnd->nKey, fnd->szIP);
else puts("key %ld was not found", tmp.nKey);

/* Now lets qsort by IP Address */
qsort( devlist, 4, sizeof *devlist, IPcompare );
puts("Values after IP Address qsort");
for(i = 0;i < 4;i++)
printf("Item %d, IP: %s, Key: %ld\n", i, devlist[i].szIP,

devlist[i].nKey);
/* search for IP address */
puts("Now we look for a a key (DeviceID) by "
"IP address - search on 192.168.1.3");
strcpy(tmp.szIP,"192.168.1.3");
if((fnd = bsearch(&tmp, devlist, 4, sizeof *devlist,
IPcompare)) != NULL)
printf( "nKey: %ld found (searched using %s\n", fnd->nKey ,

fnd->szIP );
else puts("nKey, NOT found!" );
return 0;
}

int compare( const void* val1, const void* val2 )
{ /* Sort by key */
const struct mystruct* sp1 = val1;
const struct mystruct *sp2 = val2;

return (sp2->nKey>sp1->nKey)?-1:(sp2->nKey != sp1->nKey);
}

int IPcompare( const void* arg1, const void* arg2 )
{
/* Sort by IP */
const struct mystruct *sp1 = arg1;
const struct mystruct *sp2 = arg2;

return strcmp( sp1->szIP, sp2->szIP );
}
--
Al Bowers
Tampa, Fl USA
mailto: xa******@myrapidsys.com (remove the x to send email)
http://www.geocities.com/abowers822/

Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ramprasad A Padmanabhan | last post by:
I have written a simple script to search a word in an array But bsearch does not seem to work here. I know I am missing out something very simple , But I am not able to find out what Thanks...
11
by: Ramprasad A Padmanabhan | last post by:
I have got a pretty simple script , that uses bsearch to look for a particular element The problem is , it simply segfaults inside the compare function. I have a similar script that works fine...
6
by: Michiel Rapati-Kekkonen | last post by:
bsearch finds me only the first occurrence of something I'm looking for, but I would like to know the place in the list where it is found. The index of it's place in the array. So that I can check...
2
by: Michiel Rapati-Kekkonen | last post by:
recently I was put on the right trail in the matter of searching in arrays of structs. I got it working, a bit. Unfortunately, as soon as I want more, I'm stuck again: it is basically a...
13
by: val | last post by:
Hi, I found that Windows CE doesn't include bsearch function. Can somebody point me into right direction in order to solve that issue Thanks, val
3
by: c_programmer | last post by:
I have a problem. There is a effective dated list FAMILY_ACCOUNTS stored in the memory. How to achieve the equivalent of the following SQL statement: select * from FAMILY_ACCOUNTS FA where...
2
by: Bit Byter | last post by:
I am hacking some legacy code and have put together a simple test to test some hashing funcs I've written. I now want to do a simplistic timing between the various structs. Here's a snippet: ...
0
by: jyotsnamk | last post by:
Hi, I am facing a problem using bsearch . Even though the data Im searching for is present in the array, the function returns a NULL object. The array is a structure with the following...
4
by: Amandil | last post by:
Hi, all. I'd like to check whether a certain string (one that I got from a user, or read from a file) is contained in a table of strings. The format of the table is char *table = { "string1",...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.