| 107 | } |
| 108 | |
| 109 | UINT64 |
| 110 | FCopyFile ( |
| 111 | FILE *in, |
| 112 | FILE *out |
| 113 | ) |
| 114 | /*++ |
| 115 | Routine Description: |
| 116 | Write all the content of input file to output file. |
| 117 | |
| 118 | Arguments: |
| 119 | in - input file pointer |
| 120 | out - output file pointer |
| 121 | |
| 122 | Return: |
| 123 | UINT64 : file size of input file |
| 124 | --*/ |
| 125 | { |
| 126 | UINT32 filesize, offset, length; |
| 127 | CHAR8 Buffer[8*1024]; |
| 128 | |
| 129 | fseek (in, 0, SEEK_END); |
| 130 | filesize = ftell(in); |
| 131 | |
| 132 | fseek (in, 0, SEEK_SET); |
| 133 | |
| 134 | offset = 0; |
| 135 | while (offset < filesize) { |
| 136 | length = sizeof(Buffer); |
| 137 | if (filesize-offset < length) { |
| 138 | length = filesize-offset; |
| 139 | } |
| 140 | |
| 141 | fread (Buffer, length, 1, in); |
| 142 | fwrite (Buffer, length, 1, out); |
| 143 | offset += length; |
| 144 | } |
| 145 | |
| 146 | return filesize; |
| 147 | } |
| 148 | |
| 149 | |
| 150 | int |