/ Sams Teach Yourself C in 21 Days (6th Edition)
/ STYC216E.ISO / mac / Examples / Day17 / strdup.c ![]() | < prev | next > |
MacBinary | 2002-08-11 | 896 b | [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, Sun Aug 11 10:36:02 2002, modified Sun Aug 11 10:36:02 2002, creator 'LMAN', type ASCII, 380 bytes "strdup.c" , at 0x1fc 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 08 73 74 72 64 75 70 | 2e 63 00 00 00 00 00 00 |..strdup|.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 01 7c 00 | 00 01 1e b9 7c 26 d2 b9 |......|.|....|&..|
|00000060| 7c 26 d2 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 8e 5d 00 00 |........|.....]..|
|00000080| 2f 2a 20 54 68 65 20 6e | 6f 6e 2d 41 4e 53 49 20 |/* The n|on-ANSI |
|00000090| 73 74 72 64 75 70 28 29 | 20 66 75 6e 63 74 69 6f |strdup()| functio|
|000000a0| 6e 2e 20 2a 2f 0d 0a 23 | 69 6e 63 6c 75 64 65 20 |n. */..#|include |
|000000b0| 3c 73 74 64 6c 69 62 2e | 68 3e 0d 0a 23 69 6e 63 |<stdlib.|h>..#inc|
|000000c0| 6c 75 64 65 20 3c 73 74 | 64 69 6f 2e 68 3e 0d 0a |lude <st|dio.h>..|
|000000d0| 23 69 6e 63 6c 75 64 65 | 20 3c 73 74 72 69 6e 67 |#include| <string|
|000000e0| 2e 68 3e 0d 0a 0d 0a 63 | 68 61 72 20 73 6f 75 72 |.h>....c|har sour|
|000000f0| 63 65 5b 5d 20 3d 20 22 | 54 68 65 20 73 6f 75 72 |ce[] = "|The sour|
|00000100| 63 65 20 73 74 72 69 6e | 67 2e 22 3b 0d 0a 0d 0a |ce strin|g.";....|
|00000110| 69 6e 74 20 6d 61 69 6e | 28 20 76 6f 69 64 20 29 |int main|( void )|
|00000120| 0d 0a 7b 0d 0a 20 20 20 | 20 63 68 61 72 20 2a 64 |..{.. | char *d|
|00000130| 65 73 74 3b 0d 0a 0d 0a | 20 20 20 20 69 66 20 28 |est;....| if (|
|00000140| 20 28 64 65 73 74 20 3d | 20 73 74 72 64 75 70 28 | (dest =| strdup(|
|00000150| 73 6f 75 72 63 65 29 29 | 20 3d 3d 20 4e 55 4c 4c |source))| == NULL|
|00000160| 29 0d 0a 20 20 20 20 7b | 0d 0a 20 20 20 20 20 20 |).. {|.. |
|00000170| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|00000180| 2c 20 22 45 72 72 6f 72 | 20 61 6c 6c 6f 63 61 74 |, "Error| allocat|
|00000190| 69 6e 67 20 6d 65 6d 6f | 72 79 2e 22 29 3b 0d 0a |ing memo|ry.");..|
|000001a0| 20 20 20 20 20 20 20 20 | 65 78 69 74 28 31 29 3b | |exit(1);|
|000001b0| 0d 0a 20 20 20 20 7d 0d | 0a 0d 0a 20 20 20 20 70 |.. }.|... p|
|000001c0| 72 69 6e 74 66 28 22 54 | 68 65 20 64 65 73 74 69 |rintf("T|he desti|
|000001d0| 6e 61 74 69 6f 6e 20 3d | 20 25 73 5c 6e 22 2c 20 |nation =| %s\n", |
|000001e0| 64 65 73 74 29 3b 0d 0a | 20 20 20 20 72 65 74 75 |dest);..| retu|
|000001f0| 72 6e 20 30 3b 0d 0a 7d | 0d 0a 0d 0a 00 00 00 00 |rn 0;..}|........|
|00000200| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000210| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|00000220| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|00000230| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000270| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000280| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000290| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000300| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000310| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|00000320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+