Search:

Type: Posts; User: sbaginov

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    2,696

    Solved

    ** Thank you so much!!


    gchar *get_hash(const gchar *filepath, GChecksumType hash_type) {
    FILE *fp;
    if (NULL != (fp = fopen(filepath, "rb"))) {
    guchar buffer[65536];
    gint read_bytes;...
  2. Replies
    5
    Views
    2,696

    Yes, you are right. gchar *get_hash(const...

    Yes, you are right.



    gchar *get_hash(const gchar *filepath, GChecksumType hash_type) {
    FILE *fp;
    if (NULL != (fp = fopen(filepath, "r+b"))) {
    guchar buffer[65536];
    ...
  3. Replies
    5
    Views
    2,696

    glib & g_checksum_*

    Though I am a glib fan, I really cannot use the g_checksum_* functions to obtain an MD5 string that is compatible with the md5sum command.


    gchar *get_hash(const gchar *filepath) {
    FILE *fp;...
  4. Replies
    16
    Views
    10,972

    For those who might have come here looking for a...

    For those who might have come here looking for a solution to the original question, I have found that can be done this way or - more easily - the CDT way.
  5. Replies
    16
    Views
    10,972

    @all: Thank you guys for the feedbacks. I think...

    @all:
    Thank you guys for the feedbacks.
    I think I do really have to rethink the way I was looking at the problem when timidly abandoning the pure C89 to just enter the real world.
  6. Replies
    16
    Views
    10,972

    Yes this it. Eclipse compiles everything and I...

    Yes this it.
    Eclipse compiles everything and I can run the binary from a terminal window.
    In fact, I would like to run my program inside the IDE that flawlessly integrates gdb, too.

    @jeffcobb...
  7. Replies
    16
    Views
    10,972

    Eclipse CDT & curses

    Newbie question.
    Adding curses support to a C app generates the following:

    Error opening terminal: unknown.as soon as it is compiled in the Eclipse IDE.

    Is there a...
  8. I would investigate the standard qsort() function...

    I would investigate the standard qsort() function that might be used like this:


    qsort(Employee, elements_num, sizeof(single employee type), _Employee_cmp);
    Thus you should only pay attention on...
  9. Replies
    15
    Views
    3,347

    @Salem: thank you for sharing! That's interesting...

    @Salem: thank you for sharing! That's interesting indeed!
  10. Replies
    4
    Views
    1,160

    void my_func(char *[], int); can be written ...

    void my_func(char *[], int);
    can be written

    void my_func(char **, int);
    as well because of C pointers and arrays nature.

    Since you already know other languages, not to get bored by the same...
  11. Replies
    4
    Views
    1,160

    The following is one way of doing what you want...

    The following is one way of doing what you want in plain C89/ISOC90
    #include <stdio.h>
    #include <stdlib.h>

    /* prototype */
    void my_func(char *[], int);

    int main(int argc, char *argv[]) {
    ...
  12. Replies
    3
    Views
    824

    Thx. It's so bad that code like the latter cannot...

    Thx. It's so bad that code like the latter cannot be written like we do in other languages...
  13. At the moment I got no time, so I will give you...

    At the moment I got no time, so I will give you some code to look at instead: I usually allocate memory with this function:


    char *ds_new(const unsigned int len) {
    char *r;

    if...
  14. Replies
    3
    Views
    824

    Memory leaks question

    Assuming I have function f(n) that dynamically allocates n bytes/chars/...
    I regularly try to wirte code like this
    char *s, *s1, *s2;
    s1 = f(n);
    s2 = f(m);
    s = concat("ss", s1, s2);...
  15. Though I am not a C guru yet, I think that should...

    Though I am not a C guru yet, I think that should not be a standard C way to differently manage the input.
    What you are looking for should be platform and compiler specific.
  16. Replies
    2
    Views
    1,880

    Well, thx tabstop, after lunch this bit of code...

    Well, thx tabstop, after lunch this bit of code works completely unchanged...

    Here follows a version that does not need ctype.h inclusion any more because toupper(), tolower() and isspace()...
  17. Replies
    11
    Views
    2,365

    When you code, you always have to think about the...

    When you code, you always have to think about the future use of it. Now you can read just numbers less than or equal to 100, because you type them and you are lazy!, but tomorrow, in real life, your...
  18. But even if it were? Why should others care about...

    But even if it were? Why should others care about that?

    Anyway, my UDF is this:

    void str_rev(char s[]) {
    int c, i, j;

    for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
    c =...
  19. Replies
    2
    Views
    1,880

    str_capitalize UDF problem

    Hi all, this is my UDF

    void str_capitalize(char s[]) {
    char c;
    int up = 1;

    while (s) {
    if (up) {
    if (!isspace(*s)) {
    c = toupper(*s);
Results 1 to 19 of 19