www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - dos.h _dos_findfirst example

reply Victor P. Dura <vpdura hiwaay.net> writes:
Hello,

I'm evaluating the DM C compiler for use in porting old MS DOS C v6.0
code. When I try to compile/ling the example code from the dos.h
_dos_findfirst example I get:


d:\c60\test>sc ffirst.c
link ffirst,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

ffirst.obj(ffirst)
 Error 42: Symbol Undefined __dos_findfirst
ffirst.obj(ffirst)
 Error 42: Symbol Undefined __dos_findnext

--- errorlevel 2

Does anyone have any suggestions as to what I might be doing wrong?


Thanks for any help. Here's the example code:

 /*      Example for _dos_findfirst and _dos_findnext         */ 
        #include <dos.h>
        #include <stdio.h> 
        #include <stdlib.h>

        void list_name( struct find_t fileinfo)
        { 
                int result; 
                result = _dos_findnext (& fileinfo);
                if (result == 0) 
                { 
                   printf ("% s\n", fileinfo. name); 
                   list_name (fileinfo);
                } 
                else
                   printf ("List done\n"); 
        }
        void main() 
        { 
                int result; 
                struct find_t ffblk; 

                result = _dos_findfirst ("*.dat", _A_NORMAL,
                                           &ffblk); 
                if (result == 0)
        { 
                printf ("% s\n", ffblk. name);
                list_name (ffblk); 
        }
        else 
                printf ("No files match *.dat\n"); 
        } 
Nov 14 2001
parent Jan Knepper <jan smartsoft.cc> writes:
You will have to compile with
sc -ml ffirst.c
Or other compiler flags that generate a DOS executable.
sc now by default generates a Win32 executable. Win32 does not have
_dos_findfirst or _dos_findnext.

HTH

Jan



"Victor P. Dura" wrote:

 Hello,

 I'm evaluating the DM C compiler for use in porting old MS DOS C v6.0
 code. When I try to compile/ling the example code from the dos.h
 _dos_findfirst example I get:

 d:\c60\test>sc ffirst.c
 link ffirst,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 ffirst.obj(ffirst)
  Error 42: Symbol Undefined __dos_findfirst
 ffirst.obj(ffirst)
  Error 42: Symbol Undefined __dos_findnext

 --- errorlevel 2

 Does anyone have any suggestions as to what I might be doing wrong?

 Thanks for any help. Here's the example code:

  /*      Example for _dos_findfirst and _dos_findnext         */
         #include <dos.h>
         #include <stdio.h>
         #include <stdlib.h>

         void list_name( struct find_t fileinfo)
         {
                 int result;
                 result = _dos_findnext (& fileinfo);
                 if (result == 0)
                 {
                    printf ("% s\n", fileinfo. name);
                    list_name (fileinfo);
                 }
                 else
                    printf ("List done\n");
         }
         void main()
         {
                 int result;
                 struct find_t ffblk;

                 result = _dos_findfirst ("*.dat", _A_NORMAL,
                                            &ffblk);
                 if (result == 0)
         {
                 printf ("% s\n", ffblk. name);
                 list_name (ffblk);
         }
         else
                 printf ("No files match *.dat\n");
         }

Nov 14 2001