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
    22,306
    <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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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,657
    Probably depends on the development environment. Google "msdn getcwd" if you're using Visual Studio.

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    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;
    }
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

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, 04:25 PM
  2. Confusion on header and source files
    By dnguyen1022 in forum C++ Programming
    Replies: 4
    Last Post: 01-17-2009, 03:42 AM
  3. #include header files or .cpp files?
    By DoctorX in forum C++ Programming
    Replies: 3
    Last Post: 12-23-2006, 12:21 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

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