Search:

Type: Posts; User: hellork

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    7,711

    Personally, I do not bother to set them on...

    Personally, I do not bother to set them on projects like these preferring to use scope rules, but in a larger program, especially one of those projects that is full of hacks and uses globals all over...
  2. Replies
    3
    Views
    2,463

    I know, it was declared as an array, but the...

    I know, it was declared as an array, but the variable, line, oddly enough, is treated by the compiler as though it were a pointer.
    Cprogramming.com FAQ > Pointers And Arrays (intermediate)

    To get...
  3. Replies
    10
    Views
    4,151

    I know this was just a learning exercise, but...

    I know this was just a learning exercise, but standard programming practice is to put the file-to-string conversion into a function and make it reusable. A rudimentary example function might take a...
  4. Replies
    6
    Views
    1,427

    That's why some think it is good practice to set...

    That's why some think it is good practice to set variables to NULL after freeing the pointer. I once wrote wrapper functions that keep track of malloc and free and take care of stuff like this, but...
  5. Thread: Empty tringle

    by hellork
    Replies
    2
    Views
    1,079

    If you're going to use printf, why not use printf...

    If you're going to use printf, why not use printf formatted output?

    #include<stdio.h>
    int main (void) {
    int i = 10;
    int n = i;
    printf ("%*s\n",i+1,"*");
    while (--i) printf...
  6. Nit-pickers will notice that the letter 't' is...

    Nit-pickers will notice that the letter 't' is also in common. Free code is never guaranteed to be bug free!
  7. I just did something like this, so the user could...

    I just did something like this, so the user could mix, match, and combine long and short options.
    -p -q -d -t
    -pdquiet -tabs
    -pullq -droptabs


    #define HAS(a) strstr(argv[argc],#a)
    if...
  8. Replies
    9
    Views
    2,952

    I have used the development library for ffmpeg...

    I have used the development library for ffmpeg with some success. The .MOV container is pretty simple, I think. Just some basic atoms to store audio and video. But if I were to do this again, I would...
  9. Replies
    2
    Views
    767

    You could also read the number in as a string of...

    You could also read the number in as a string of characters. Limit input to some arbitrary size and then store them somewhere convenient, like a slightly larger array of char. Then loop through and...
  10. Thread: Pointers in C

    by hellork
    Replies
    3
    Views
    1,052

    Pointers are variables. Cprogramming.com FAQ > A...

    Pointers are variables.
    Cprogramming.com FAQ > A tutorial on pointers

    Also getch(); is not defined in stdio.h and on Linux getch() only works within special curses applications that disable line...
  11. Thread: structure copy

    by hellork
    Replies
    7
    Views
    3,451

    Just use the = operator. #include ...

    Just use the = operator.

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

    typedef struct {
    char Words[88];
    } UniqueWords;
    UniqueWords w0={"HEY"}, w1 = {"Hello Struct Copy!"};
    int main (void) {
  12. Replies
    12
    Views
    1,821

    This is how that code could (sort of) potentially...

    This is how that code could (sort of) potentially work, even though I think after looking at this that it is fundamentally the wrong way of doing it. Song names can not have spaces in them, are...
  13. Thread: Playing Music

    by hellork
    Replies
    5
    Views
    1,481

    Greetings and Happy Turkey Day! :) That is a...

    Greetings and Happy Turkey Day! :)

    That is a fine concept there though it has errors.
    Arrays start at 0, not at i = 1.
    songlist will never == NULL because the array is not terminated with 0...
  14. Replies
    5
    Views
    2,421

    You could also use an enum. #include ...

    You could also use an enum.

    #include <stdio.h>

    enum {play=1,stats,quit};
    int main (void){
    int input;
    scanf (" %d",&input);
    switch (input){
    case play:
  15. Replies
    4
    Views
    2,192

    I'm not sure how much this helps determine...

    I'm not sure how much this helps determine periodicity, but here is a way to at least get the same sequence...
    from rand(3): pseudo-random number generator - Linux man page


    POSIX.1-2001 gives...
  16. Replies
    37
    Views
    6,760

    'Eat' is not hex!

    Hello. How is the weather? We have had 2" of snow here and a bit too cold to go out, so I decided to look for a program to write.

    Is this what you were trying to do?

    anch -run ishex.a.c...
  17. Replies
    3
    Views
    825

    I imagine that a simple code breaker could also...

    I imagine that a simple code breaker could also be written to attack substitution schemes like this with frequency analysis (LFQ). Then the most common letters can be printed out. A message like...
  18. Replies
    3
    Views
    963

    Consider a 2 x 2 grid. All possible paths from a...

    Consider a 2 x 2 grid. All possible paths from a to b would be a square.

    a
    *--*
    | |
    *--*b

    Now just recurse :D

    Sorry... I couldn't resist!
  19. Replies
    2
    Views
    1,586

    Since you said you use Linux, look at GTK+ -...

    Since you said you use Linux, look at GTK+ - About
    It is cross-platform and supports loading images into a click-able map.

    Some boilerplate code from GtkImage:

    static gboolean...
  20. Replies
    14
    Views
    7,420

    Perhaps davidjg is in need of a pseudocode...

    Perhaps davidjg is in need of a pseudocode compiler :D
    Anchor | freshmeat.net
  21. Replies
    2
    Views
    947

    Good effort. :) * malloc returns an address. You...

    Good effort. :)
    * malloc returns an address. You are trying to assign that to a variable of type record which is"typedef struct students" not a pointer.
    * malloc uses memory which must be free()'d...
  22. Replies
    1
    Views
    1,122

    What results were you expecting? It looks like...

    What results were you expecting? It looks like you have some parenthesis out of place. Here is the pseudocode of what I think you were trying to do (indentation is used instead of parenthesis).

    ...
  23. Replies
    9
    Views
    2,342

    Nice try! Turn on compiler warnings. It should...

    Nice try! Turn on compiler warnings. It should help some. :D


    standard says to use int main (void)
    main must return an int
    scanf can eat up whitespace before entries. try scanf " %d %d" ...
  24. Replies
    6
    Views
    5,013

    Please check out this really cool link :) ...

    Please check out this really cool link :)

    http://cboard.cprogramming.com/cplusplus-programming/13473-posting-code-read-first.html
  25. Thread: CISCO or ???

    by hellork
    Replies
    3
    Views
    1,211

    Heh, so you want to play with pcap...

    Heh, so you want to play with pcap? I don't know of any "course" that teaches man in the middle attacks. I wouldn't do it because packet inspection is so simple I would feel like I was taking...
Results 1 to 25 of 40
Page 1 of 2 1 2