Search:

Type: Posts; User: stevong

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. I guess I've finally learn to appreciate! My rants!

    Hi,

    After medding around with C, linux, (and a little bit of sockets), I've realize that I'm always taking things for granted.

    It takes so much work to write a proper and solid application. You...
  2. What is there a need to zero out sockaddr_in structs?

    Hi,

    I happened to read up on some nix sockets and I'm kinda hooked.

    The sample scripts often mentioning about zero-ing up the structs of sockaddr_in.



    memset(&(my_addr.sin_zero), ’\0’,...
  3. You meant, something similiar to this? My struct...

    You meant, something similiar to this? My struct has a member int which auto increment by one...




    node *GetNode(int idx)
    {
    node *curr = NULL;
    curr=LastNode;
    while(curr)
  4. My concepts on memory alloc and pointers are...

    My concepts on memory alloc and pointers are still totally screwed. Im confusing myself at times. (I feel guilty posting all these threads at times)

    Ok, here's the oringinal show all nodes, which...
  5. *blushed* I often used trial and error to...

    *blushed*
    I often used trial and error to venture into new territories and trying out new stuffs. =p My luck indeed ran out. haha.

    I've used pointer to pointer because

    **ptr is the same as...
  6. Thread: Starting age

    by stevong
    Replies
    32
    Views
    8,214

    But truth hurts: Not everyone is a child...

    But truth hurts: Not everyone is a child prodigy....
  7. I came up with something "similiar". And it works...

    I came up with something "similiar". And it works fine. Im puzzled.



    person **testing()
    {
    person **test;
    test[0] = malloc(sizeof(person));
    test[1] = malloc(sizeof(person));
    ...
  8. Thanks Salem and Quzah :) After some reading...

    Thanks Salem and Quzah :)

    After some reading up, I came out with the following:



    node **ShowAllNodes()
    {
    node *curr = NULL;
    node **RtnValues=NULL;
  9. But I can't seems to iterate through it. What...

    But I can't seems to iterate through it.

    What I intend to do is have a function that will loop through the linked list; collect all the structs and store them in an array.

    This function will...
  10. Array of Structs - How do you move to the next struct in the array?

    Hi,

    Let's say I have an array of structs.
    How do I move through the array to retrieve the next struct in list?

    Please advise. Thanks :)
  11. Yes I do. The intention of this thread is to...

    Yes I do.

    The intention of this thread is to hope that someone can break down that single line of code into simpler statements in which layman/newbies can understand. :)

    Thanks to ...
  12. Haha. yea. I didnt read his post clearly. I...

    Haha. yea. I didnt read his post clearly.

    I almost fell off my chair when I read his post all over again.
  13. Thanks. That's sweet.:)

    Thanks. That's sweet.:)
  14. EDIT: What are you trying to say?

    EDIT: What are you trying to say?
  15. "FAQ > How do I... (Level 2) > Work with dates and times" - Queries.

    Dear experts,

    I was browsing through the FAQs when I stumbled on one portion:



    int leap_year ( int year )
    {
    return year % 4 == 0 && ( year % 100 != 0 || year % 400 == 0 );
    }
  16. oh ok..Hmm...I just wrote and tested this and it...

    oh ok..Hmm...I just wrote and tested this and it seems fine in my outputs.
    it managed to clear unwanted buffer (the extra buffer that exceeded the desire char length) and the irritating \n at end of...
  17. Oh ok. Thanks! I shall play with it again. But...

    Oh ok. Thanks! I shall play with it again.

    But about backspaces '\b'?

    Are \b being taken in also? And what about tabs '\t' ?

    Are they considered to be one character also?
  18. fgets - It will always return [string] + newline + nul?

    Sorry. Im still a bit upset over input validation.

    Consider the following:


    fgets(BUF,10,stdin);


    BUF is supposed to take in 10 chars. But only 9 chars will be readable by us. Since the...
  19. Replies
    3
    Views
    2,854

    :eek: LOL. Silly me. Got it. I got what you...

    :eek: LOL. Silly me. Got it. I got what you meant. :p

    I'll try again.

    This looks better :D



    int PartialFind(char *f)
    {
  20. Replies
    3
    Views
    2,854

    strstr() - Not able to get it to work.

    Hi. It's me again. Can anyone figure why the first code listing, doesnt work despite passing in the correct values?

    Whereas if I hardcode the values in the 2nd listing, it works.

    :confused:
    ...
  21. Replies
    3
    Views
    2,298

    Oh yes. You r right. :D. The \n is causing the...

    Oh yes. You r right. :D. The \n is causing the problem.

    Managed to solve the "double execution" by using

    while(fgetc(stdin)!='\n');


    i used -'0' because i want to cast the char back to int...
  22. Replies
    3
    Views
    2,298

    Sorry. Topic should read fgetc() instead of...

    Sorry. Topic should read fgetc() instead of fgets()
  23. Replies
    3
    Views
    2,298

    fgetc() and Switch-Case - Executed twice?

    Hi Guys,

    Im trying out C inputs. But the following code seems to be running out of expectations.

    When the program runs, it asked for 1,2,3. I entered 1. It should print out "1". Then asking me...
  24. Hmm. So that using printf("%s",c[0]) will out put...

    Hmm. So that using printf("%s",c[0]) will out put ".-", printf("%s",c[1]) will out put "-..."; in which they are the morse rep of the alphabets....

    37 is because..26 alphabets, plus 10 numbers?...
  25. I've rewrote the whole thing. Based on my shallow...

    I've rewrote the whole thing. Based on my shallow understanding of dynamic memory alloc and pointers. (hopefully)

    Learning C is not a bed of roses... :(

    Please help me... :( Thanks..

    1. I...
Results 1 to 25 of 42
Page 1 of 2 1 2