/ Sams Teach Yourself C in 21 Days (6th Edition)
/ STYC216E.ISO / mac / Examples / TR / seconds.c ![]() | < prev | next > |
MacBinary | 2002-04-27 | 1.4 KB | [TEXT/LMAN] |
Confidence | Program | Detection | Match Type | Support |
---|---|---|---|---|
66% | dexvert | Compact Compressed (Unix) (archive/compact) | ext | Supported |
10% | dexvert | MacBinary (archive/macBinary) | fallback | Supported |
1% | dexvert | Text File (text/txt) | fallback | Supported |
100% | file | MacBinary II, Sat Apr 27 15:45:14 2002, modified Sat Apr 27 15:45:14 2002, creator 'LMAN', type ASCII, 861 bytes "seconds.c" , at 0x3dd 286 bytes resource | default (weak) | |
99% | file | data | default | |
74% | TrID | Macintosh plain text (MacBinary) | default | |
25% | TrID | MacBinary 2 | default (weak) | |
100% | siegfried | fmt/1762 MacBinary (II) | default | |
100% | lsar | MacBinary | default |
id metadata | |
---|---|
key | value |
macFileType | [TEXT] |
macFileCreator | [LMAN] |
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 73 65 63 6f 6e 64 | 73 2e 63 00 00 00 00 00 |..second|s.c.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4c 4d 41 | 4e 00 00 ff ff ff ff 00 |.TEXTLMA|N.......|
|00000050| 00 00 00 00 00 03 5d 00 | 00 01 1e b8 f0 b0 4a b8 |......].|......J.|
|00000060| f0 b0 4a 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..J.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c5 f2 00 00 |........|........|
|00000080| 2f 2a 20 73 65 63 6f 6e | 64 73 2e 63 20 2a 2f 0d |/* secon|ds.c */.|
|00000090| 0a 2f 2a 20 50 72 6f 67 | 72 61 6d 20 74 68 61 74 |./* Prog|ram that|
|000000a0| 20 70 61 75 73 65 73 2e | 20 2a 2f 0d 0a 0d 0a 23 | pauses.| */....#|
|000000b0| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 69 6f 2e 68 |include |<stdio.h|
|000000c0| 3e 0d 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 74 64 |>..#incl|ude <std|
|000000d0| 6c 69 62 2e 68 3e 0d 0a | 23 69 6e 63 6c 75 64 65 |lib.h>..|#include|
|000000e0| 20 3c 74 69 6d 65 2e 68 | 3e 0d 0a 0d 0a 76 6f 69 | <time.h|>....voi|
|000000f0| 64 20 73 6c 65 65 70 28 | 20 69 6e 74 20 6e 62 72 |d sleep(| int nbr|
|00000100| 5f 73 65 63 6f 6e 64 73 | 20 29 3b 0d 0a 0d 0a 69 |_seconds| );....i|
|00000110| 6e 74 20 6d 61 69 6e 28 | 20 76 6f 69 64 20 29 0d |nt main(| void ).|
|00000120| 0a 7b 0d 0a 20 20 20 20 | 69 6e 74 20 63 74 72 3b |.{.. |int ctr;|
|00000130| 0d 0a 20 20 20 20 69 6e | 74 20 77 61 69 74 20 3d |.. in|t wait =|
|00000140| 20 31 33 3b 0d 0a 0d 0a | 20 20 20 20 2f 2a 20 50 | 13;....| /* P|
|00000150| 61 75 73 65 20 66 6f 72 | 20 61 20 6e 75 6d 62 65 |ause for| a numbe|
|00000160| 72 20 6f 66 20 73 65 63 | 6f 6e 64 73 2e 20 50 72 |r of sec|onds. Pr|
|00000170| 69 6e 74 20 61 20 2a 0d | 0a 20 20 20 20 20 2a 20 |int a *.|. * |
|00000180| 64 6f 74 20 65 61 63 68 | 20 73 65 63 6f 6e 64 20 |dot each| second |
|00000190| 77 61 69 74 65 64 2e 20 | 20 20 20 20 20 20 20 20 |waited. | |
|000001a0| 20 20 20 20 20 20 20 2a | 2f 0d 0a 0d 0a 20 20 20 | *|/.... |
|000001b0| 20 70 72 69 6e 74 66 28 | 22 44 65 6c 61 79 20 66 | printf(|"Delay f|
|000001c0| 6f 72 20 25 64 20 73 65 | 63 6f 6e 64 73 5c 6e 22 |or %d se|conds\n"|
|000001d0| 2c 20 77 61 69 74 20 29 | 3b 0d 0a 20 20 20 20 70 |, wait )|;.. p|
|000001e0| 72 69 6e 74 66 28 22 3e | 22 29 3b 0d 0a 0d 0a 20 |rintf(">|");.... |
|000001f0| 20 20 20 66 6f 72 20 28 | 63 74 72 3d 31 3b 20 63 | for (|ctr=1; c|
|00000200| 74 72 20 3c 3d 20 77 61 | 69 74 3b 20 63 74 72 2b |tr <= wa|it; ctr+|
|00000210| 2b 29 0d 0a 20 20 20 20 | 7b 0d 0a 20 20 20 20 20 |+).. |{.. |
|00000220| 20 20 70 72 69 6e 74 66 | 28 22 2e 22 29 3b 20 20 | printf|("."); |
|00000230| 20 20 20 20 20 2f 2a 20 | 70 72 69 6e 74 20 61 20 | /* |print a |
|00000240| 64 6f 74 20 2a 2f 0d 0a | 20 20 20 20 20 20 20 66 |dot */..| f|
|00000250| 66 6c 75 73 68 28 73 74 | 64 6f 75 74 29 3b 20 20 |flush(st|dout); |
|00000260| 20 20 2f 2a 20 66 6f 72 | 63 65 20 64 6f 74 20 74 | /* for|ce dot t|
|00000270| 6f 20 70 72 69 6e 74 20 | 6f 6e 20 62 75 66 66 65 |o print |on buffe|
|00000280| 72 65 64 20 6d 61 63 68 | 69 6e 65 73 20 2a 2f 0d |red mach|ines */.|
|00000290| 0a 20 20 20 20 20 20 20 | 73 6c 65 65 70 28 20 28 |. |sleep( (|
|000002a0| 69 6e 74 29 20 31 20 29 | 3b 20 20 2f 2a 20 70 61 |int) 1 )|; /* pa|
|000002b0| 75 73 65 20 31 20 73 65 | 63 6f 6e 64 20 2a 2f 0d |use 1 se|cond */.|
|000002c0| 0a 20 20 20 20 7d 0d 0a | 20 20 20 20 70 72 69 6e |. }..| prin|
|000002d0| 74 66 28 20 22 44 6f 6e | 65 21 5c 6e 22 29 3b 0d |tf( "Don|e!\n");.|
|000002e0| 0a 20 20 20 20 72 65 74 | 75 72 6e 20 28 30 29 3b |. ret|urn (0);|
|000002f0| 0d 0a 7d 0d 0a 0d 0a 2f | 2a 20 50 61 75 73 65 73 |..}..../|* Pauses|
|00000300| 20 66 6f 72 20 61 20 73 | 70 65 63 69 66 69 65 64 | for a s|pecified|
|00000310| 20 6e 75 6d 62 65 72 20 | 6f 66 20 73 65 63 6f 6e | number |of secon|
|00000320| 64 73 20 2a 2f 0d 0a 76 | 6f 69 64 20 73 6c 65 65 |ds */..v|oid slee|
|00000330| 70 28 20 69 6e 74 20 6e | 62 72 5f 73 65 63 6f 6e |p( int n|br_secon|
|00000340| 64 73 20 29 0d 0a 7b 0d | 0a 20 20 20 20 63 6c 6f |ds )..{.|. clo|
|00000350| 63 6b 5f 74 20 67 6f 61 | 6c 3b 0d 0a 0d 0a 20 20 |ck_t goa|l;.... |
|00000360| 20 20 67 6f 61 6c 20 3d | 20 28 20 6e 62 72 5f 73 | goal =| ( nbr_s|
|00000370| 65 63 6f 6e 64 73 20 2a | 20 43 4c 4f 43 4b 53 5f |econds *| CLOCKS_|
|00000380| 50 45 52 5f 53 45 43 20 | 29 20 2b 20 63 6c 6f 63 |PER_SEC |) + cloc|
|00000390| 6b 28 29 3b 0d 0a 0d 0a | 20 20 20 20 77 68 69 6c |k();....| whil|
|000003a0| 65 28 20 67 6f 61 6c 20 | 3e 20 63 6c 6f 63 6b 28 |e( goal |> clock(|
|000003b0| 29 20 29 0d 0a 20 20 20 | 20 7b 0d 0a 20 20 20 20 |) ).. | {.. |
|000003c0| 20 20 20 3b 20 2f 2a 20 | 6c 6f 6f 70 20 2a 2f 0d | ; /* |loop */.|
|000003d0| 0a 20 20 20 20 7d 0d 0a | 7d 0d 0a 0d 0a 00 00 00 |. }..|}.......|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000410| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|00000420| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|00000430| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|00000440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000470| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000480| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000490| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000500| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000510| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+