Search:

Type: Posts; User: Heraclitus

Search: Search took 0.00 seconds.

  1. Replies
    1
    Views
    1,402

    Checking for errors on output streams

    void write_deletion(D_RECORD *record, FILE *outfile)
    {
    fputc(record->type,outfile);
    fputc(record->code[0],outfile);
    fputc(record->code[1],outfile);
    fputc(record->code[2],outfile);...
  2. Thread: fgets

    by Heraclitus
    Replies
    14
    Views
    1,964

    strtok()

    /* Create a "proper" buffer ;) */
    char string[640K_OUGHT_TO_BE_ENOUGH_FOR_ANYBODY];
    fgets(string,sizeof(string),stdin);
    strtok(string,"\n"); /* Will replace the first newline in string with a...
  3. Replies
    4
    Views
    7,194

    /* No need for conditional tests, just initialise...

    /* No need for conditional tests, just initialise a char array with the values that you wish to use. No need to worry about ASCII codes. */
    const char array[] =...
  4. Replies
    5
    Views
    7,252

    struct sizes { int e_size; }; struct...

    struct sizes
    {
    int e_size;
    };

    struct sizes headersizes = {(int)sizeof(struct ethhdr)};

    ...
    int main...
  5. Replies
    3
    Views
    1,470

    XOR encryption

    You may want to look into XOR encryption, it is very simple, yet highly effective.
    The basic idea is:
    char ^ key_val = encrypted_char

    Coincidently, I wrote a simple program that implements this...
  6. Replies
    1
    Views
    1,786

    Thanks for the reply man, but I have just found...

    Thanks for the reply man, but I have just found out what the problem was: no "fflush(stdout);". I kicked myself after realising that I overlooked this. :)
  7. Replies
    1
    Views
    1,786

    Pipe not working fully

    I have made a little program that works similar to cat, but it also decrypts/encrypts the stream, as well as printing to stdout. It does this by simple XOR encryption.



    /* XOR each character in...
  8. Replies
    4
    Views
    1,179

    Heraclitus

    The reason for the numbers being the same, if I am not mistaken, is due to the fact that srand(time(NULL)) will set the random seed using the system time (in seconds). As you are calling it twice in...
Results 1 to 8 of 8