Just to share with you some hash implementations that I found on the Web:
* http://www.burtleburtle.net/bob/hash/doobs.html by Bob Jenkins,
* http://www.zentus.com/c/hash.html by David Crawshaw.
Type: Posts; User: SoFarAway
Just to share with you some hash implementations that I found on the Web:
* http://www.burtleburtle.net/bob/hash/doobs.html by Bob Jenkins,
* http://www.zentus.com/c/hash.html by David Crawshaw.
If there are codes that can be reused, why don't use them? hehe.. :)
Thanks for the useful link!
Hi all,
I am looking for a hash written in C that meets the following needs:
* the size of the hash, n, is known and fixed before initialization, and n is large;
* only init_hash(),...
I've tried out this:
#include <stdio.h>
int findMax(int[], int ); /* prototype*/
int main() {
int nums [10][20], i, j, m = 0;
for (i=0; i < 10; ++i)
Hi all,
how to pass the pointer of a two dimension array to a function?
Is it something like
int array[10][5];
func( &array[0][0] );
...
Hi..
Actually what i am asking is how to check that "try.txt" is open for read or write, that means some functions will tell you that "try.txt" is open for read, so i cannot perform any write...
I use
int fildes;
fildes = open("try.txt", O_RDONLY);
to open a file "try.txt" for read. How do i check that this file is open for read or write later on?
Hi all,
Other than using m = lseek(fildes, 0, 2) to find out the size of a file, do you know other ways of doing it?
Thanks..
Now it runs correctly.
Thanks!
RH9 and GCC3.2
Strange...
Hi, all,
Here i try to open a file, close it, and then try to close it again:
int fd, result;
fd = open("myfile", O_RDONLY);
printf("file descriptor: %d\n", fd);
Hi, Dave_Sinkula,
Your method works. But the header is a fixed API, i cannot change int read_line(char *buf) to char *read_line(char *buf)...
Is there another way to do it?
Thank you...
How to keep track the result malloc gives me?
buf points to the location of malloc inside the function read_line(buf), but how come it does not point to the same location outside the function? or...
Another problem is, when i use
int read_line(char *buf) {
int max_size = findmaxsize();
buf = malloc(max_size + 1);
// do something about buf...
printf("%s\n", buf);
It works..
Thanx Quzah!! You are amazing!! :eek:
Yes, you are correct! buf does not point to a valid value. But i cannot change the header int read_line(char *buf) cos it is a fixed API given.
So how can i make buf points to an array of char...
But i also cannot code like
char *result[max_size];
int i;
for(i = 0; i < max_size; i++)
result[i] = (char *)malloc(sizeof(char));
cos i also need max_size at run-time. right?
so how...
Hi, all,
I have the following problem:
int read_line(char *buf) {
int max_size = findmaxsize();
char result[max_size];
// put some char into result
Thanks...
I fixed the problem already..
I have a file "b.txt", which is 16 bytes long:
b.txt:
00 12 32 a5 6f ff 11 67 00 00 00 11 fa 90 44 66
I use the following code to change the first 2 bytes of b.txt, and it works.
Hi all,
I have a file "myfile", i want to write a 4 bytes word to a particular place of offset 20 from the start of the file by using mmap. Can i do like this:
int fd, n;
unsigned char...
Hi all,
Is there a good way to create a new file with 1024 bytes, and initiate it to all 0's ?
Thank you...
Hi all,
We have atoi() to convert a string into an integer. How about the other way round?
Can anyone tell me how to convert an integer into a string? Thank you..
Hi all,
I am doing a embedded system project using Handel-C now. I need some tutorials and exercises on Handel-C cos i have not touched on it before.
Could anyone pose some useful links about...
Thanks.. :)