home *** CD-ROM | disk | FTP | other *** search
/ Sams Teach Yourself C in 21 Days (6th Edition) / STYC216E.ISO / mac / Examples / Day17 / strcpy.c < prev    next >
MacBinary  |  2002-08-11  |  1.3 KB  |  [TEXT/LMAN]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
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, Sun Aug 11 10:35:06 2002, modified Sun Aug 11 10:35:06 2002, creator 'LMAN', type ASCII, 760 bytes "strcpy.c" , at 0x378 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
keyvalue
macFileType[TEXT]
macFileCreator[LMAN]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 73 74 72 63 70 79 | 2e 63 00 00 00 00 00 00 |..strcpy|.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 02 f8 00 | 00 01 1e b9 7c 26 9a b9 |........|....|&..|
|00000060| 7c 26 9a 00 00 00 00 00 | 00 00 00 00 00 00 00 00 ||&......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 1c 73 00 00 |........|.....s..|
|00000080| 2f 2a 20 44 65 6d 6f 6e | 73 74 72 61 74 65 73 20 |/* Demon|strates |
|00000090| 73 74 72 63 70 79 28 29 | 2e 20 2a 2f 0d 0a 23 69 |strcpy()|. */..#i|
|000000a0| 6e 63 6c 75 64 65 20 3c | 73 74 64 6c 69 62 2e 68 |nclude <|stdlib.h|
|000000b0| 3e 0d 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 74 64 |>..#incl|ude <std|
|000000c0| 69 6f 2e 68 3e 0d 0a 23 | 69 6e 63 6c 75 64 65 20 |io.h>..#|include |
|000000d0| 3c 73 74 72 69 6e 67 2e | 68 3e 0d 0a 0d 0a 63 68 |<string.|h>....ch|
|000000e0| 61 72 20 73 6f 75 72 63 | 65 5b 5d 20 3d 20 22 54 |ar sourc|e[] = "T|
|000000f0| 68 65 20 73 6f 75 72 63 | 65 20 73 74 72 69 6e 67 |he sourc|e string|
|00000100| 2e 22 3b 0d 0a 0d 0a 69 | 6e 74 20 6d 61 69 6e 28 |.";....i|nt main(|
|00000110| 20 76 6f 69 64 20 29 0d | 0a 7b 0d 0a 20 20 20 20 | void ).|.{.. |
|00000120| 63 68 61 72 20 64 65 73 | 74 31 5b 38 30 5d 3b 0d |char des|t1[80];.|
|00000130| 0a 20 20 20 20 63 68 61 | 72 20 2a 64 65 73 74 32 |. cha|r *dest2|
|00000140| 2c 20 2a 64 65 73 74 33 | 3b 0d 0a 0d 0a 20 20 20 |, *dest3|;.... |
|00000150| 20 70 72 69 6e 74 66 28 | 22 5c 6e 73 6f 75 72 63 | printf(|"\nsourc|
|00000160| 65 3a 20 25 73 22 2c 20 | 73 6f 75 72 63 65 20 29 |e: %s", |source )|
|00000170| 3b 0d 0a 0d 0a 20 20 20 | 20 2f 2a 20 43 6f 70 79 |;.... | /* Copy|
|00000180| 20 74 6f 20 64 65 73 74 | 31 20 69 73 20 6f 6b 61 | to dest|1 is oka|
|00000190| 79 20 62 65 63 61 75 73 | 65 20 64 65 73 74 31 20 |y becaus|e dest1 |
|000001a0| 70 6f 69 6e 74 73 20 74 | 6f 20 2a 2f 0d 0a 20 20 |points t|o */.. |
|000001b0| 20 20 2f 2a 20 38 30 20 | 62 79 74 65 73 20 6f 66 | /* 80 |bytes of|
|000001c0| 20 61 6c 6c 6f 63 61 74 | 65 64 20 73 70 61 63 65 | allocat|ed space|
|000001d0| 2e 20 2a 2f 0d 0a 0d 0a | 20 20 20 20 73 74 72 63 |. */....| strc|
|000001e0| 70 79 28 64 65 73 74 31 | 2c 20 73 6f 75 72 63 65 |py(dest1|, source|
|000001f0| 29 3b 0d 0a 20 20 20 20 | 70 72 69 6e 74 66 28 22 |);.. |printf("|
|00000200| 5c 6e 64 65 73 74 31 3a | 20 20 25 73 22 2c 20 64 |\ndest1:| %s", d|
|00000210| 65 73 74 31 29 3b 0d 0a | 0d 0a 20 20 20 20 2f 2a |est1);..|.. /*|
|00000220| 20 54 6f 20 63 6f 70 79 | 20 74 6f 20 64 65 73 74 | To copy| to dest|
|00000230| 32 20 79 6f 75 20 6d 75 | 73 74 20 61 6c 6c 6f 63 |2 you mu|st alloc|
|00000240| 61 74 65 20 73 70 61 63 | 65 2e 20 2a 2f 0d 0a 0d |ate spac|e. */...|
|00000250| 0a 20 20 20 20 64 65 73 | 74 32 20 3d 20 28 63 68 |. des|t2 = (ch|
|00000260| 61 72 20 2a 29 6d 61 6c | 6c 6f 63 28 73 74 72 6c |ar *)mal|loc(strl|
|00000270| 65 6e 28 73 6f 75 72 63 | 65 29 20 2b 31 29 3b 0d |en(sourc|e) +1);.|
|00000280| 0a 20 20 20 20 73 74 72 | 63 70 79 28 64 65 73 74 |. str|cpy(dest|
|00000290| 32 2c 20 73 6f 75 72 63 | 65 29 3b 0d 0a 20 20 20 |2, sourc|e);.. |
|000002a0| 20 70 72 69 6e 74 66 28 | 22 5c 6e 64 65 73 74 32 | printf(|"\ndest2|
|000002b0| 3a 20 20 25 73 5c 6e 22 | 2c 20 64 65 73 74 32 29 |: %s\n"|, dest2)|
|000002c0| 3b 0d 0a 0d 0a 20 20 20 | 20 2f 2a 20 43 6f 70 79 |;.... | /* Copy|
|000002d0| 69 6e 67 20 77 69 74 68 | 6f 75 74 20 61 6c 6c 6f |ing with|out allo|
|000002e0| 63 61 74 69 6e 67 20 64 | 65 73 74 69 6e 61 74 69 |cating d|estinati|
|000002f0| 6f 6e 20 73 70 61 63 65 | 20 69 73 20 61 20 6e 6f |on space| is a no|
|00000300| 2d 6e 6f 2e 20 2a 2f 0d | 0a 20 20 20 20 2f 2a 20 |-no. */.|. /* |
|00000310| 54 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 63 6f |The foll|owing co|
|00000320| 75 6c 64 20 63 61 75 73 | 65 20 73 65 72 69 6f 75 |uld caus|e seriou|
|00000330| 73 20 70 72 6f 62 6c 65 | 6d 73 2e 20 2a 2f 0d 0a |s proble|ms. */..|
|00000340| 0d 0a 20 20 20 20 2f 2a | 20 73 74 72 63 70 79 28 |.. /*| strcpy(|
|00000350| 64 65 73 74 33 2c 20 73 | 6f 75 72 63 65 29 3b 20 |dest3, s|ource); |
|00000360| 2a 2f 0d 0a 20 20 20 20 | 72 65 74 75 72 6e 20 30 |*/.. |return 0|
|00000370| 3b 0d 0a 7d 0d 0a 0d 0a | 00 00 00 00 00 00 00 00 |;..}....|........|
|00000380| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000390| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|000003a0| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|000003b0| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 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 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000410| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|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 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000490| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 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 |........|........|
+--------+-------------------------+-------------------------+--------+--------+