TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Francois Thunus
from: Mikko Hyvarinen
date: 1996-10-07 15:13:02
subject: silly findfirst question

(cut)
 FT> This works as advertised when compiled to os/2 EXE with Emx.
 FT> However
 FT> 1) I'm getting a warning "assignment makes pointer from integer
 FT> without a cast" on the malloc line why ? I've always done that under
 FT> dos and my compiler never complained ?

You're not declaring a prototype for malloc(), so gcc assumes it returns an
integer value.

#include 

After this modification:

=== Cut ===
test.c: In function `main':
test.c:22: invalid lvalue in unary `&'
test.c:22: invalid lvalue in unary `&'
test.c:26: invalid lvalue in unary `&'
=== Cut ===

This is because the "variables" referenced with the &
operators are #defined, and as such have no lvalues. Use initialized
integer variables instead.

 FT> 2) when compiled to dual standart (ie dos/os/2 exe with rsx/emx.dll)
 FT> it still works under os/2 but bombs out with GP in a dos box. Related
 FT> to previous ? what to do ?

Not related to previous. DosFindFirst etc are OS/2 functions despite their
name, so don't even try to use them under DOS. Use these instead:

=== cut ===
#include                                                [POSIX.1]
#include              /* this is recommended */
#include             /* this also works (for now) */

DIR *opendir (char *name);
int closedir (DIR *dirp);
struct dirent *readdir (DIR *dirp);
void seekdir (DIR *dirp, long off);
long telldir (DIR *dirp);
void rewinddir (DIR *dirp);

    Scan directories.  opendir() opens the directory whose name is in
    the string pointed to by NAME for scanning.  If there is an error,
    NULL is returned.  Otherwise a value is returned which is used
    with the other functions to continue the scanning.

    closedir() ends the directory scan of DIRP.  After closing DIRP,
    you must not use DIRP.  You should close all handles created by
    opendir().

    readdir() retrieves the next directory entry for DIRP.  If there
    are no more directory entries, NULL is returned.

    seekdir() moves to the specified directory entry of DIRP.  If OFF
    is 0, the first directory entry will be read next.  If OFF is 1,
    the second directory entry will be read next.  And so on.
    seekdir() is not a POSIX.1 function.

    telldir() returns the current position in DIRP.  0 is returned for
    the first directory entry.  telldir() is not a POSIX.1 function.

    rewinddir() is equivalent to seekdir (0).

    These functions use _fnlwr() to convert the file names to lower
    case on upper-case-only file systems.

  Return value:

    opendir() returns a descriptor to be used with the other
    functions.  On error, opendir() returns NULL.

    closedir() returns 0 if successful, -1 on error.

    readdir() returns a pointer to a directory entry.  If there are no
    more directory entries, readdir() returns NULL.

    telldir() returns the current position in DIRP.

  See also: _fnlwr(), _wildcard()
=== cut ===

---
* Origin: Hand me the Holy Handgrenade! (2:229/229.5)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 229/0 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.