popen with a fossil (split from bumped thread)

This is a discussion on popen with a fossil (split from bumped thread) within the Windows Programming forums, part of the Platform Specific Boards category; Hey everyone! I can't get the following code compile under borland compiler: Warning clock.c 11: Nonportable pointer conversion in function ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    7

    popen with a fossil (split from bumped thread)

    Hey everyone!

    I can't get the following code compile under borland compiler:


    Warning clock.c 11: Nonportable pointer conversion in function main
    Turbo Link Version 5.0 Copyright (c) 1992 Borland International
    Error: Undefined symbol __pclose in module clock.c
    Error: Undefined symbol __popen in module clock.c


    Available memory 4145152


    I appreciate any help!



    Code:
    #include <stdio.h>
    
    #define popen _popen
    #define pclose _pclose
      
    int main(){
    
    	   FILE *fp;
    	   char line[130];			
       
    	   fp = _popen("netstat -n", "r");
    
    
       while ( fgets( line, sizeof line, fp))
    		{
    		  printf("%s", line);
    		}
    	   _pclose(fp);
    
    
    getch();
    return(0);
    }

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Code:
    #ifdef _WIN32_
    # define popen _popen
    # define pclose _pclose
    #endif
    Why is that so difficult to place in a header file?

  3. #3
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657
    Turbo Link Version 5.0 Copyright (c) 1992 Borland International
    Heh, running this on an 8088?

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Now, now, let us not judge. Besides, at least he is keeping portablility in mind. That is more than I can say for many of the folks who are posting for their first time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a thread sleep or std::recv timeout?
    By BrianK in forum Linux Programming
    Replies: 3
    Last Post: 02-26-2003, 10:27 PM
  2. Multithreading
    By Cela in forum Windows Programming
    Replies: 13
    Last Post: 01-15-2003, 03:02 PM
  3. Your Best thread and your most stupid thread ??
    By jawwadalam in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 01-03-2003, 07:41 PM
  4. MFC Controls and Thread Safety :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 12-06-2002, 11:36 AM
  5. Multi-Thread Programming
    By drdroid in forum C++ Programming
    Replies: 6
    Last Post: 04-04-2002, 02:53 PM

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