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

#print
With your 'cc' command you can give the name of
an object file to be loaded with your program.
For example
   cc x.c y.o
will load the previously compiled program 'y' along with
the program 'x' to be compiled now.
There is a file in this directory named "getnum.o"
that contains a subroutine "getnum" that will read digits
from the standard input, convert them to binary, and
return an integer value.

Write a program which reads an integer and prints
it back in octal.  Compile and test as usual.
#once #create Ref
254
#once cp %s/getnum.o .
#user
a.out <Ref >test
grep 376 test >/dev/null
#succeed
/*	One way: */

main() {
	printf("%o\n", getnum());
}
#log
#next
11.1a 10

unix.superglobalmegacorp.com

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