what header files for these directives?

This is a discussion on what header files for these directives? within the C Programming forums, part of the General Programming Boards category; Dear All, i have copied the code from CBOARD FAQ section to find the current working dir...but my compiler showing ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    83

    what header files for these directives?

    Dear All,
    i have copied the code from CBOARD FAQ section to find the current working dir...but my compiler showing header file not found??
    i am using window 2000 operating system
    Code:
    #include <sys/param.h> 
    #include <unistd.h> 
    #include <stdio.h> 
    
    int main(void)
    {
      char buf[MAXPATHLEN];
      if( getcwd( buf, MAXPATHLEN ) ) 
      {
        printf( "%s\n", buf );
      }
      return 0;
    }
    could any body help me correct header files for me?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,631
    <sys/param.h> and <unistd.h> are not standard C headers, but POSIX standard headers (I think, having never actually read that standard), and consequently not available in Windows except via Cygwin and (not in all cases) MinGW.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,664
    Probably depends on the development environment. Google "msdn getcwd" if you're using Visual Studio.

  4. #4
    "I Win!" by U. Lose vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,754
    Depending on your compiler... for example for VS6 I have
    Code:
    #include <stdio.h> 
    #include <windows.h>
    #include <DIRECT.H>
    
    int main(void)
    {
      char buf[MAX_PATH];
      if( getcwd( buf, sizeof buf ) ) 
      {
        printf( "&#37;s\n", buf );
      }
      return 0;
    }
    To be or not to be == true

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Confusion on header and source files
    By dnguyen1022 in forum C++ Programming
    Replies: 4
    Last Post: 01-17-2009, 02:42 AM
  3. #include header files or .cpp files?
    By DoctorX in forum C++ Programming
    Replies: 3
    Last Post: 12-23-2006, 11:21 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21