Search:

Type: Posts; User: rrc55

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    2,225

    I've expanded my program to do a few more things...

    I've expanded my program to do a few more things . I'm a total noob and I'm just messing around with this in hopes of learning some things so please don't make too much fun of me. :p Anyway, I've...
  2. Replies
    2
    Views
    2,679

    Thank you kind sir.

    Thank you kind sir.
  3. Replies
    4
    Views
    2,225

    Thanks that did the trick for dirent. As for DIR,...

    Thanks that did the trick for dirent. As for DIR, I guess you can't access its members directly? No matter, I just changed a few things and used readdir instead.

    From wikipedia:
  4. Replies
    2
    Views
    2,679

    File Positioning stdout

    Hi. Noob here just playing around with some things trying to learn. I was wondering if there is a way to print a stationary progress bar onto my console window. I tried ftell() and fseek() but that...
  5. Replies
    4
    Views
    2,225

    Directory Listing

    I wrote this test program to familiarize myself with accessing file information but I keep getting a couple of errors I can't figure out. Please help.



    #include <stdio.h>
    #include...
  6. Replies
    1
    Views
    4,164

    Here's the macro and suspect function by...

    Here's the macro and suspect function by themselves:


    #define putc(x,p) (--(p)->cnt >= 0 \
    ? *(p)->ptr++ = (x) : _flushbuf((x),p))

    int _flushbuf(int c, FILE_ *fp)
    {...
  7. Replies
    1
    Views
    4,164

    The UNIX System Interface

    I need some help with Exercise 8-3 in The C Programming Language. Basically these first exercises in chapter 8 are dealing with making our own i/o header so we can learn about system calls....
  8. Replies
    4
    Views
    3,201

    I was wondering about that. I was just about to...

    I was wondering about that. I was just about to declare my bit field as a union with an integer in it so I could assign a value to it. Thanks again.
  9. Replies
    4
    Views
    3,201

    Thank You.

    Thank You.
  10. Replies
    4
    Views
    3,201

    Accessing Member from Structure Array

    /* Exercise 8-2. Rewrite fopen and _fillbuf with fields instead of explicit bit operations.
    Compare code size and execution speed.
    */


    /* exercise.8-2.h */
    #define NULL 0
    #define EOF ...
  11. Thread: Using strndup

    by rrc55
    Replies
    2
    Views
    11,595

    Ah, thank you. I actually tried defining...

    Ah, thank you. I actually tried defining __USE_GNU because that's what's in my /usr/inlude/string.h
  12. Thread: Using strndup

    by rrc55
    Replies
    2
    Views
    11,595

    Using strndup

    I'd like to know how to use this function in my program. I've included string.h but I still get this warning when compiling.

    I'd appreciate some help with this. Thanks.
  13. Replies
    5
    Views
    5,861

    Actually vars == &vars[0] so ++vars would be the...

    Actually vars == &vars[0] so ++vars would be the same as &vars[1] and so *++vars == vars[1]. :p

    Went back and reread section 5.3 of K&R and found my answer.


    Thanks for the replies everyone.
  14. Replies
    5
    Views
    5,861

    -> has the highest precedence so that should give...

    -> has the highest precedence so that should give me the address of my pointer array.

    ++ and * have the same precedence and associate from right to left so it should increment my array address...
  15. Replies
    5
    Views
    5,861

    Incrementing Structure Member Array

    Will someone please tell me why this


    *++p->vars = NULL;
    gives me this error
    vars is an array of pointers to char and p is a pointer to a structure. vars is a member of that structure.

    Thank...
  16. Replies
    15
    Views
    3,646

    hehe ;)

    hehe ;)
  17. Replies
    15
    Views
    3,646

    Turns out my input file had more lines than my...

    Turns out my input file had more lines than my MAXLINES. Can't believe I overlooked especially considering someone tried to point that out to me! Anyway, sorry for the confusion and thanks for the...
  18. Replies
    15
    Views
    3,646

    Thank you but I ahve already accounted for this.

    Thank you but I ahve already accounted for this.
  19. Replies
    15
    Views
    3,646

    Wow silly me. Of course it doesn't work in the...

    Wow silly me. Of course it doesn't work in the loop because the loop still doesnt end.

    ***

    Although I still don't get why getline was counting 1 more the length I wanted, it was an easy fix....
  20. Replies
    15
    Views
    3,646

    Spoke to soon. I tested the first line out of the...

    Spoke to soon. I tested the first line out of the loop and it worked. When I use the loop without the "+ 1" in the calloc parameter I still get a segmentation fault in my strcpy line. I'll get back...
  21. Replies
    15
    Views
    3,646

    Yeah thanks guys. So it turns out my getline...

    Yeah thanks guys. So it turns out my getline function was returning length + 1 the whole time so my while loop never finished and that's why e was so high. For now I just removed the "+ 1" from my...
  22. Replies
    15
    Views
    3,646

    Yeah that's my version of getline and it does...

    Yeah that's my version of getline and it does terminate the string. e does go past MAXLINES though.
  23. Replies
    15
    Views
    3,646

    Thank you both. I'm still getting a...

    Thank you both.

    I'm still getting a segmentation fault. This time in the strcpy line.



    while (l = getline(storeline, MAXLEN))
    {
    lines[e] = calloc(l + 1, 1);
    strcpy(lines[e++],...
  24. Replies
    15
    Views
    3,646

    malloc and calloc

    Would someone explain to me how to use these? I keep getting a segmentation fault on this line:


    strcpy(lines[e++] = calloc(l + 1, l + 1), storeline);lines is a pointer array, storeline is a...
  25. Replies
    10
    Views
    5,488

    Well all of this is beyond my level of C...

    Well all of this is beyond my level of C knowledge. I'll just have to do without this one test for now. Thanks for the help anyway guys.
Results 1 to 25 of 38
Page 1 of 2 1 2