Home » Archimedes archive » Acorn User » AU 1995-05.adf » !C_C » printf
printf
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1995-05.adf » !C_C |
Filename: | printf |
Read OK: | ✔ |
File size: | 0CFC bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
�����@��EasyC ARM Linker 2.02��`� O���0S�������0S�����_-���_-���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ����0��@��P����`��V�j�`�e��h�� �jh��V�@�����0�����4����:A�Q�aR�B+��Shared C library not loaded��Shared C library is out of date`���@����@���`�������p���C����D���������@-���,�������$��P�����@-����@��������p�X��p�����printf and scanf - C for Yourself May 1995 ------------------------------------------ Variable 1 = %d, variable 2 = %d. Floating point variable = %f The last variable only has four decimal places, but it was printed out to six. This can be altered by including other information along with the conversion specifiers, as follows. Floating point number to 4 decimal places: %.4f This is how you print a fixed width field: %7d %7d %7.4f %7.4f %7d %7d You can also change the justification so that the figures are left justified. %-7d %-7d %-7.4f Characters can also be printed: %c Please press RETURN to continue. That last printf cleared the screen by using the code \f. If you want to print the \ character, use \\ as the control code. Please enter a new integer for var1: %dNow, please enter another integer for var2: %dFinally, please enter a floating point number for fvar: %ftestfilewFile open failed. Please change directory to one which has write access. This is some text, and this is variable 1: %d Variable 2: %d Floating point variable: %.4f File close failed. Sorry! A text file called 'testfile' has just been created in the current directory. Try loading it into Edit... ���0�-��L� ]����M�������"�����叁����O�@�����O�@���� �����O�@������-�O�@�����O�@���}O�@���MO�@������-�!O�@�����O�@������-� �����O�@������Ѝ�����-�0�����-�O�@������Ѝ�O�@�����O�@�������-� ����O������Ѝ�BP��P����O�@���O������P��P��O�@���=O���O�@���eO�@��� ��OO�@����� P� �����O�����GO�@����� P� ����6O�����3O�@����� P� ����CO�A��O���@��UO@���0�[ ��O�A��������-� ���O�����~���Ѝ���t����,@ű.nP� O@s���O�@�o���O�m�����0�[�
00000000 00 00 a0 e1 00 00 a0 e1 0f 00 00 eb 40 01 00 eb |............@...| 00000010 11 00 00 ef 45 61 73 79 43 20 41 52 4d 20 4c 69 |....EasyC ARM Li| 00000020 6e 6b 65 72 20 20 00 00 32 2e 30 32 00 00 00 00 |nker ..2.02....| 00000030 00 00 00 00 fc 8c 00 00 60 9b 00 00 00 00 00 00 |........`.......| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 20 10 4f e2 |............ .O.| 00000050 0c 00 91 e8 02 30 53 e0 0e f0 b0 d1 00 00 a0 e3 |.....0S.........| 00000060 04 00 82 e4 04 30 53 e2 fc ff ff ca 0e f0 b0 e1 |.....0S.........| 00000070 ff 5f 2d e9 ff 9f fd e8 ff 5f 2d e9 ff 9f fd e8 |._-......_-.....| 00000080 00 f0 a0 e3 00 f0 a0 e3 00 f0 a0 e3 00 f0 a0 e3 |................| * 00000410 00 f0 a0 e3 00 f0 a0 e3 00 f0 a0 e3 10 00 02 ef |................| 00000420 01 20 a0 e1 a4 10 9f e5 00 30 e0 e3 00 40 a0 e3 |. .......0...@..| 00000430 00 50 e0 e3 9c 00 8f e2 94 60 9f e5 00 00 56 e3 |.P.......`....V.| 00000440 01 6a a0 03 00 60 96 14 06 65 a0 e1 06 68 a0 e1 |.j...`...e...h..| 00000450 81 06 0a ef 06 00 00 6a 06 68 a0 e1 05 08 56 e3 |.......j.h....V.| 00000460 00 40 a0 a1 98 00 8f a2 00 30 a0 a3 03 ff ff aa |.@.......0......| 00000470 34 00 8f e2 00 10 90 e4 3a 1d 41 e2 02 15 51 e2 |4.......:.A...Q.| 00000480 7f 10 61 52 00 00 8f 42 2b 00 00 ef 90 0e 80 00 |..aR...B+.......| 00000490 53 68 61 72 65 64 20 43 20 6c 69 62 72 61 72 79 |Shared C library| 000004a0 20 6e 6f 74 20 6c 6f 61 64 65 64 00 91 0e 80 00 | not loaded.....| 000004b0 53 68 61 72 65 64 20 43 20 6c 69 62 72 61 72 79 |Shared C library| 000004c0 20 69 73 20 6f 75 74 20 6f 66 20 64 61 74 65 00 | is out of date.| 000004d0 60 9b 00 00 00 00 00 00 01 00 00 00 80 80 00 00 |`...............| 000004e0 40 81 00 00 fc 8c 00 00 18 90 00 00 02 00 00 00 |@...............| 000004f0 40 81 00 00 1c 84 00 00 18 90 00 00 60 9b 00 00 |@...........`...| 00000500 ff ff ff ff 80 80 00 00 70 85 00 00 88 85 00 00 |........p.......| 00000510 43 00 00 00 c0 ff ff ea 44 00 9f e5 18 12 1a e5 |C.......D.......| 00000520 01 00 80 e0 01 10 a0 e3 00 10 c0 e4 00 40 2d e9 |.............@-.| 00000530 04 00 8d e2 2c 10 9f e5 06 00 91 e9 13 ff ff eb |....,...........| 00000540 24 00 9f e5 00 00 50 e3 00 00 8f 12 00 80 fd e8 |$.....P.........| 00000550 00 40 2d e9 d0 fe ff eb 00 40 bd e8 08 10 9f e5 |.@-......@......| 00000560 08 ff ff ea 11 8e 00 00 70 85 00 00 58 8a 00 00 |........p...X...| 00000570 18 00 00 00 10 85 00 00 70 85 00 00 10 85 00 00 |........p.......| 00000580 18 85 00 00 00 00 00 00 e1 ff ff ea 70 72 69 6e |............prin| 00000590 74 66 20 61 6e 64 20 73 63 61 6e 66 20 2d 20 43 |tf and scanf - C| 000005a0 20 66 6f 72 20 59 6f 75 72 73 65 6c 66 20 4d 61 | for Yourself Ma| 000005b0 79 20 31 39 39 35 0a 00 2d 2d 2d 2d 2d 2d 2d 2d |y 1995..--------| 000005c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000005e0 2d 2d 0a 0a 00 56 61 72 69 61 62 6c 65 20 31 20 |--...Variable 1 | 000005f0 3d 20 25 64 2c 20 76 61 72 69 61 62 6c 65 20 32 |= %d, variable 2| 00000600 20 3d 20 25 64 2e 0a 00 46 6c 6f 61 74 69 6e 67 | = %d...Floating| 00000610 20 70 6f 69 6e 74 20 76 61 72 69 61 62 6c 65 20 | point variable | 00000620 3d 20 25 66 0a 0a 00 54 68 65 20 6c 61 73 74 20 |= %f...The last | 00000630 76 61 72 69 61 62 6c 65 20 6f 6e 6c 79 20 68 61 |variable only ha| 00000640 73 20 66 6f 75 72 20 64 65 63 69 6d 61 6c 20 70 |s four decimal p| 00000650 6c 61 63 65 73 2c 20 62 75 74 20 69 74 20 77 61 |laces, but it wa| 00000660 73 0a 00 70 72 69 6e 74 65 64 20 6f 75 74 20 74 |s..printed out t| 00000670 6f 20 73 69 78 2e 20 54 68 69 73 20 63 61 6e 20 |o six. This can | 00000680 62 65 20 61 6c 74 65 72 65 64 20 62 79 20 69 6e |be altered by in| 00000690 63 6c 75 64 69 6e 67 20 6f 74 68 65 72 0a 00 69 |cluding other..i| 000006a0 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 6c 6f 6e 67 |nformation along| 000006b0 20 77 69 74 68 20 74 68 65 20 63 6f 6e 76 65 72 | with the conver| 000006c0 73 69 6f 6e 20 73 70 65 63 69 66 69 65 72 73 2c |sion specifiers,| 000006d0 20 61 73 20 66 6f 6c 6c 6f 77 73 2e 0a 0a 00 46 | as follows....F| 000006e0 6c 6f 61 74 69 6e 67 20 70 6f 69 6e 74 20 6e 75 |loating point nu| 000006f0 6d 62 65 72 20 74 6f 20 34 20 64 65 63 69 6d 61 |mber to 4 decima| 00000700 6c 20 70 6c 61 63 65 73 3a 20 25 2e 34 66 0a 0a |l places: %.4f..| 00000710 00 54 68 69 73 20 69 73 20 68 6f 77 20 79 6f 75 |.This is how you| 00000720 20 70 72 69 6e 74 20 61 20 66 69 78 65 64 20 77 | print a fixed w| 00000730 69 64 74 68 20 66 69 65 6c 64 3a 0a 00 25 37 64 |idth field:..%7d| 00000740 20 25 37 64 20 25 37 2e 34 66 0a 00 25 37 2e 34 | %7d %7.4f..%7.4| 00000750 66 20 25 37 64 20 25 37 64 0a 0a 00 59 6f 75 20 |f %7d %7d...You | 00000760 63 61 6e 20 61 6c 73 6f 20 63 68 61 6e 67 65 20 |can also change | 00000770 74 68 65 20 6a 75 73 74 69 66 69 63 61 74 69 6f |the justificatio| 00000780 6e 20 73 6f 20 74 68 61 74 20 74 68 65 20 66 69 |n so that the fi| 00000790 67 75 72 65 73 20 61 72 65 0a 00 6c 65 66 74 20 |gures are..left | 000007a0 6a 75 73 74 69 66 69 65 64 2e 0a 00 25 2d 37 64 |justified...%-7d| 000007b0 20 25 2d 37 64 20 25 2d 37 2e 34 66 0a 0a 00 43 | %-7d %-7.4f...C| 000007c0 68 61 72 61 63 74 65 72 73 20 63 61 6e 20 61 6c |haracters can al| 000007d0 73 6f 20 62 65 20 70 72 69 6e 74 65 64 3a 20 25 |so be printed: %| 000007e0 63 0a 0a 00 50 6c 65 61 73 65 20 70 72 65 73 73 |c...Please press| 000007f0 20 52 45 54 55 52 4e 20 74 6f 20 63 6f 6e 74 69 | RETURN to conti| 00000800 6e 75 65 2e 0a 00 0c 00 54 68 61 74 20 6c 61 73 |nue.....That las| 00000810 74 20 70 72 69 6e 74 66 20 63 6c 65 61 72 65 64 |t printf cleared| 00000820 20 74 68 65 20 73 63 72 65 65 6e 20 62 79 20 75 | the screen by u| 00000830 73 69 6e 67 20 74 68 65 20 63 6f 64 65 20 5c 66 |sing the code \f| 00000840 2e 0a 00 49 66 20 79 6f 75 20 77 61 6e 74 20 74 |...If you want t| 00000850 6f 20 70 72 69 6e 74 20 74 68 65 20 5c 20 63 68 |o print the \ ch| 00000860 61 72 61 63 74 65 72 2c 20 75 73 65 20 5c 5c 20 |aracter, use \\ | 00000870 61 73 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 63 |as the control c| 00000880 6f 64 65 2e 0a 0a 00 50 6c 65 61 73 65 20 65 6e |ode....Please en| 00000890 74 65 72 20 61 20 6e 65 77 20 69 6e 74 65 67 65 |ter a new intege| 000008a0 72 20 66 6f 72 20 76 61 72 31 3a 0a 00 25 64 00 |r for var1:..%d.| 000008b0 4e 6f 77 2c 20 70 6c 65 61 73 65 20 65 6e 74 65 |Now, please ente| 000008c0 72 20 61 6e 6f 74 68 65 72 20 69 6e 74 65 67 65 |r another intege| 000008d0 72 20 66 6f 72 20 76 61 72 32 3a 0a 00 25 64 00 |r for var2:..%d.| 000008e0 46 69 6e 61 6c 6c 79 2c 20 70 6c 65 61 73 65 20 |Finally, please | 000008f0 65 6e 74 65 72 20 61 20 66 6c 6f 61 74 69 6e 67 |enter a floating| 00000900 20 70 6f 69 6e 74 20 6e 75 6d 62 65 72 20 66 6f | point number fo| 00000910 72 20 66 76 61 72 3a 0a 00 25 66 00 74 65 73 74 |r fvar:..%f.test| 00000920 66 69 6c 65 00 77 00 46 69 6c 65 20 6f 70 65 6e |file.w.File open| 00000930 20 66 61 69 6c 65 64 2e 20 50 6c 65 61 73 65 20 | failed. Please | 00000940 63 68 61 6e 67 65 20 64 69 72 65 63 74 6f 72 79 |change directory| 00000950 20 74 6f 20 6f 6e 65 20 77 68 69 63 68 20 68 61 | to one which ha| 00000960 73 20 77 72 69 74 65 20 61 63 63 65 73 73 2e 0a |s write access..| 00000970 00 54 68 69 73 20 69 73 20 73 6f 6d 65 20 74 65 |.This is some te| 00000980 78 74 2c 20 61 6e 64 20 74 68 69 73 20 69 73 20 |xt, and this is | 00000990 76 61 72 69 61 62 6c 65 20 31 3a 20 25 64 0a 00 |variable 1: %d..| 000009a0 56 61 72 69 61 62 6c 65 20 32 3a 20 25 64 0a 46 |Variable 2: %d.F| 000009b0 6c 6f 61 74 69 6e 67 20 70 6f 69 6e 74 20 76 61 |loating point va| 000009c0 72 69 61 62 6c 65 3a 20 25 2e 34 66 0a 00 46 69 |riable: %.4f..Fi| 000009d0 6c 65 20 63 6c 6f 73 65 20 66 61 69 6c 65 64 2e |le close failed.| 000009e0 20 53 6f 72 72 79 21 0a 00 41 20 74 65 78 74 20 | Sorry!..A text | 000009f0 66 69 6c 65 20 63 61 6c 6c 65 64 20 27 74 65 73 |file called 'tes| 00000a00 74 66 69 6c 65 27 20 68 61 73 20 6a 75 73 74 20 |tfile' has just | 00000a10 62 65 65 6e 20 63 72 65 61 74 65 64 20 69 6e 20 |been created in | 00000a20 74 68 65 20 63 75 72 72 65 6e 74 20 64 69 72 65 |the current dire| 00000a30 63 74 6f 72 79 2e 0a 00 54 72 79 20 6c 6f 61 64 |ctory...Try load| 00000a40 69 6e 67 20 69 74 20 69 6e 74 6f 20 45 64 69 74 |ing it into Edit| 00000a50 2e 2e 2e 0a 00 00 00 00 0d c0 a0 e1 30 d8 2d e9 |............0.-.| 00000a60 04 b0 4c e2 0a 00 5d e1 b8 fd ff bb 0c d0 4d e2 |..L...].......M.| 00000a70 0f c0 a0 e3 00 c0 8d e5 22 c0 a0 e3 08 c0 8d e5 |........".......| 00000a80 8f 81 9f ed 01 01 8d ed 04 00 4f e2 05 0c 40 e2 |..........O...@.| 00000a90 05 fe ff eb e4 00 4f e2 01 0b 40 e2 02 fe ff eb |......O...@.....| 00000aa0 08 20 9d e5 00 10 9d e5 cb 00 4f e2 01 0b 40 e2 |. ........O...@.| 00000ab0 fd fd ff eb 01 01 9d ed 02 81 2d ed bc 00 4f e2 |..........-...O.| 00000ac0 01 0b 40 e2 06 00 bd e8 f7 fd ff eb ad 00 4f e2 |..@...........O.| 00000ad0 01 0b 40 e2 f4 fd ff eb 7d 00 4f e2 01 0b 40 e2 |..@.....}.O...@.| 00000ae0 f1 fd ff eb 4d 00 4f e2 01 0b 40 e2 ee fd ff eb |....M.O...@.....| 00000af0 01 01 9d ed 02 81 2d ed 21 00 4f e2 01 0b 40 e2 |......-.!.O...@.| 00000b00 06 00 bd e8 e8 fd ff eb ff 00 4f e2 03 0c 40 e2 |..........O...@.| 00000b10 e5 fd ff eb 01 01 9d ed 02 81 2d ed 10 20 9d e5 |..........-.. ..| 00000b20 08 10 9d e5 ef 00 4f e2 03 0c 40 e2 08 00 bd e8 |......O...@.....| 00000b30 dd fd ff eb 04 d0 8d e2 00 c0 9d e5 04 c0 2d e5 |..............-.| 00000b40 0c 30 9d e5 02 01 9d ed 02 81 2d ed 08 00 4f e2 |.0........-...O.| 00000b50 01 0b 40 e2 06 00 bd e8 d3 fd ff eb 04 d0 8d e2 |..@.............| 00000b60 0c 00 4f e2 01 0b 40 e2 cf fd ff eb d9 00 4f e2 |..O...@.......O.| 00000b70 03 0c 40 e2 cc fd ff eb 01 01 9d ed 02 81 2d ed |..@...........-.| 00000b80 10 20 9d e5 08 10 9d e5 f9 0f 4f e2 08 00 bd e8 |. ........O.....| 00000b90 c5 fd ff eb 04 d0 8d e2 42 50 a0 e3 ff 50 05 e2 |........BP...P..| 00000ba0 05 10 a0 e1 ed 00 4f e2 03 0c 40 e2 be fd ff eb |......O...@.....| 00000bb0 f5 0f 4f e2 bc fd ff eb cb fd ff eb 00 50 a0 e1 |..O..........P..| 00000bc0 ff 50 05 e2 c6 00 4f e2 03 0c 40 e2 b6 fd ff eb |.P....O...@.....| 00000bd0 3d 0e 4f e2 b4 fd ff eb 9d 00 4f e2 03 0c 40 e2 |=.O.......O...@.| 00000be0 b1 fd ff eb 65 00 4f e2 03 0c 40 e2 ae fd ff eb |....e.O...@.....| 00000bf0 0d 10 a0 e1 4f 00 4f e2 03 0c 40 e2 ad fd ff eb |....O.O...@.....| 00000c00 b9 fd ff eb 0a 00 50 e3 00 00 00 0a fb ff ff ea |......P.........| 00000c10 da 0f 4f e2 a4 fd ff eb 08 10 8d e2 47 00 4f e2 |..O.........G.O.| 00000c20 03 0c 40 e2 a3 fd ff eb af fd ff eb 0a 00 50 e3 |..@...........P.| 00000c30 00 00 00 0a fb ff ff ea 36 0e 4f e2 9a fd ff eb |........6.O.....| 00000c40 04 10 8d e2 33 00 4f e2 03 0c 40 e2 99 fd ff eb |....3.O...@.....| 00000c50 a5 fd ff eb 0a 00 50 e3 00 00 00 0a fb ff ff ea |......P.........| 00000c60 43 10 4f e2 03 1c 41 e2 d5 0f 4f e2 8a fd ff eb |C.O...A...O.....| 00000c70 00 40 b0 e1 55 00 4f 02 03 0c 40 02 8a fd ff 0b |.@..U.O...@.....| 00000c80 30 a8 5b 09 00 20 9d e5 1f 10 4f e2 03 1c 41 e2 |0.[.. ....O...A.| 00000c90 04 00 a0 e1 85 fd ff eb 01 01 9d ed 02 81 2d ed |..............-.| 00000ca0 10 20 9d e5 c3 1f 4f e2 04 00 a0 e1 08 00 bd e8 |. ....O.........| 00000cb0 7e fd ff eb 04 d0 8d e2 04 00 a0 e1 74 fd ff eb |~...........t...| 00000cc0 01 00 00 ea a3 c1 2c 40 c5 b1 2e 6e 00 00 50 e3 |......,@...n..P.| 00000cd0 0a 00 4f 12 03 0c 40 12 73 fd ff 1b 04 00 00 1a |..O...@.s.......| 00000ce0 ff 00 4f e2 02 0c 40 e2 6f fd ff eb af 0f 4f e2 |..O...@.o.....O.| 00000cf0 6d fd ff eb 00 00 a0 e3 30 a8 5b e9 |m.......0.[.| 00000cfc