Thread: problem with stdout

  1. #1
    Registered User
    Join Date
    Jan 2009

    problem with stdout

    I necessary with your help.
    I've next scrap code...
    			if (inet_ntoa(header->dir) == "/usr/bin") {
    			printf("%s  \n", inet_ntoa(header->dir));
    Why value doesn't be printed from header->dir? Condition has been executed, but value from structure doesn't printed. Possible I should to call structure element at one time or merely once?
    I've a lot of similar calls, to suggested me whatever to do it very smart not hard? I just need impart designed my code.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Perhaps you're trying to compare strings of char's, without using strcmp(string1, string2) == 0, type code?

    You can't compare strings directly in C, like string1 == string2. That doesn't work.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Lika Adak says: You are comparing the result of the inet_ntoa() function with the the address of the string constant "/usr/bin" - since this string constant is MOST LIKELY not used in inet_ntoa(), the address isn't going to match.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  3. forcing stdout of external program to be line-buffered
    By FreakCERS in forum C Programming
    Replies: 4
    Last Post: 09-17-2006, 12:46 PM
  4. redirecting stdout
    By ichijoji in forum C++ Programming
    Replies: 2
    Last Post: 08-15-2006, 09:20 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM