Article 137054 of comp.os.vms: Path: nntpd.lkg.dec.com!eps.enet.dec.com!vandenheuvel From: vandenheuvel@eps.enet.dec.com (Hein RMS van den Heuvel) Newsgroups: comp.os.vms Subject: Re: popen in vms Date: 2 JAN 96 23:57:20 Organization: Digital Equipment Corporation Lines: 44 Message-ID: <4cd36g$b61@nntpd.lkg.dec.com> References: <9512291618.AA14035@w231zrz.zrz.TU-Berlin.DE> NNTP-Posting-Host: epsys.enet.dec.com In article <9512291618.AA14035@w231zrz.zrz.TU-Berlin.DE>, manschbf@w214zrz.zrz.TU-Berlin.DE (Nazim Manser) writes... >hi all! > >i looked for popen("command","operation") in vaxc run-time_functions >but i didn't find it. >is there a way to do the same (like popen in un*x) in vms ? Check out calling LIB$FIND_FILE (and LIB$FIND_FILE_END when done) Once you figure out how to do the descriptors, this should prove a convenient way to 'find files', returning names in a loop. [For added hackers bonus points, open up that supposedly opaque 'context' parameter to the call. You'll find a pointer to a useable FAB + NAME ] #include descrip #include rmsdef main() { int stat, stv, context = 0; $DESCRIPTOR (loop, "Loop ? "); $DESCRIPTOR (more, "More... "); $DESCRIPTOR (wild, "[.tmp]*.*"); struct dsc$descriptor_d temp_dx, file_name_dx = {0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0} ; temp_dx = file_name_dx; while (1 & lib$get_input ( &temp_dx, &loop )) { while ( 1 & ( stat = lib$find_file( &wild, &file_name_dx, &context, 0, 0, &stv, 0))) { lib$put_output ( &file_name_dx); lib$get_input ( &temp_dx, &more); } lib$find_file_end ( &context ); if (stat != RMS$_NMF) return (stat); } } Hope this helps, +--------------------------------------+ Hein van den Heuvel, Digital. | All opinions expressed are mine, and | "Makers of VMS and other | may not reflect those of my employer | fine Operating Systems." +--------------------------------------+