| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | silly findfirst question |
Hi Francois,
You asked:
FT>>----- Begin -----
FT>/* test of findfirst / findnext under emx */
FT>#include
FT>#define FindCount 1
FT>#define FindHandle 1
FT>#define FindLevel 1
FT>int main(int argc, char **argv)
FT>{
FT> int F_A;
FT> char *Search;
FT> FILEFINDBUF3 *FindBuf;
FT> int Done;
FT> F_A=0;
FT> Done=0;
FT> FindBuf=malloc(sizeof(FILEFINDBUF3));
FT> strcpy(Search,argv[1]);
......^^^^^^ !!!
You've not allocated any space for the string! Why not drop "Search"
completely and use argv[1] directly?
FT>Done=DosFindFirst(Search,&FindHandle,F_A,FindBuf,sizeof(FILE
FT>INDBUF3),&FindC ount,FindLevel);
FT> while(Done==0)
FT> {
FT> printf("file: %s\n",&FindBuf->achName);
FT> Done=DosFindNext(FindHandle,FindBuf,sizeof(FILEFINDBUF3),&FindLevel);
FT> }
FT> return(0);
FT>}
FT>>----- End -----
FT>This works as advertised when compiled to os/2 EXE with Emx.
FT>However
FT>1) I'm getting a warning
FT>"assignment makes pointer from integer without a cast" on
the malloc line
FT>why ? I've always done that under dos and my compiler never complained ?
Odd...
FT>2) when compiled to dual standart (ie dos/os/2 exe with rsx/emx.dll) it stil
FT>works under os/2 but bombs out with GP in a dos box.
FT>Related to previous ? what to do ?
The use of "String" may cause that one.
George
* SLMR 2.1a * Desk: A very large wastebasket with drawers.
--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)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: 440/4 141/209 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™.