File:  [CSRG BSD Unix] / 43BSDTahoe / usr.lib / learn / C / L16.2b
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

#print
Write a program which copies all lines containng
the letter 'p' from its input to its output.
Compile and test it; then type "ready".
#once #create Ref
mountain station south orange maplewood millburn short hills
new providence murray hill berkeley heights
bernardsville far hills peapack gladstone
#once #create badin
hoboken harrison newark roseville avenue grove street
east orange brick church orange highland avenue
mountain station south orange maplewood millburn short hills
summit chatham madison convent station morristown
new providence murray hill berkeley heights
gillette stirling millington lyons basking ridge
bernardsville far hills peapack gladstone
#once cp %s/getline.o .
#user
a.out <badin >xxx
#cmp Ref xxx
#succeed
/*	a way to find lines with 'p' */
 #include <stdio.h>

main()
{
	char line[500];
	int k;

	while (getline(line, 500) > 0)
		for (k = 0; line[k] != '\0'; k++)
			if (line[k] == 'p') {
				printf("%s", line);
				break;
			}
}
#log
#next
16.2c 5
17.1a 10

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.