Search:

Type: Posts; User: SoFarAway

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    1,450

    Just to share with you some hash implementations...

    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.
  2. Replies
    6
    Views
    1,450

    If there are codes that can be reused, why don't...

    If there are codes that can be reused, why don't use them? hehe.. :)

    Thanks for the useful link!
  3. Replies
    6
    Views
    1,450

    Hash implementations

    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(),...
  4. Replies
    27
    Views
    2,861

    I've tried out this: #include ...

    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)
  5. pass the pointer of a two dimension array to a function

    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] );
    ...
  6. Replies
    6
    Views
    2,521

    Hi.. Actually what i am asking is how to check...

    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...
  7. Replies
    6
    Views
    2,521

    check for read or 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?
  8. Replies
    2
    Views
    1,002

    size of a file

    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..
  9. Replies
    3
    Views
    2,166

    Now it runs correctly. Thanks!

    Now it runs correctly.

    Thanks!
  10. Replies
    3
    Views
    2,166

    RH9 and GCC3.2 Strange...

    RH9 and GCC3.2

    Strange...
  11. Replies
    3
    Views
    2,166

    open() and close()

    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);
  12. Replies
    14
    Views
    1,884

    Hi, Dave_Sinkula, Your method works. But the...

    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...
  13. Replies
    14
    Views
    1,884

    How to keep track the result malloc gives me? ...

    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...
  14. Replies
    14
    Views
    1,884

    Another problem is, when i use int...

    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);
  15. Replies
    14
    Views
    1,884

    It works.. Thanx Quzah!! You are amazing!! ...

    It works..

    Thanx Quzah!! You are amazing!! :eek:
  16. Replies
    14
    Views
    1,884

    Yes, you are correct! buf does not point to a...

    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...
  17. Replies
    14
    Views
    1,884

    But i also cannot code like 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...
  18. Replies
    14
    Views
    1,884

    a problem with array of char

    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
  19. Thread: mmap() error

    by SoFarAway
    Replies
    3
    Views
    1,064

    Thanks... I fixed the problem already..

    Thanks...

    I fixed the problem already..
  20. Thread: mmap() error

    by SoFarAway
    Replies
    3
    Views
    1,064

    mmap() error

    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.
  21. write a word to file by using lseek and mmap

    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...
  22. Create file with fixed length and initiate it to all 0's

    Hi all,

    Is there a good way to create a new file with 1024 bytes, and initiate it to all 0's ?

    Thank you...
  23. Replies
    7
    Views
    1,666

    Integer to String

    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..
  24. Thread: Handel-C

    by SoFarAway
    Replies
    3
    Views
    1,830

    Handel-C

    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...
  25. Replies
    2
    Views
    2,359

    Thanks.. :)

    Thanks.. :)
Results 1 to 25 of 30
Page 1 of 2 1 2