MCPcopy Create free account
hub / github.com/SimHacker/micropolis / save_short

Function save_short

MicropolisCore/src/MicropolisEngine/src/fileio.cpp:184–195  ·  view source on GitHub ↗

* Save an array of short values from memory to file. * * Convert to the correct endianness first, if necessary. * @param buf Buffer containing the short values to save. * @param len Number of short values to save. * @param f File handle of the file to save to. * @return Save was succesfull. */

Source from the content-addressed store, hash-verified

182 * @return Save was succesfull.
183 */
184static bool save_short(short *buf, int len, FILE *f)
185{
186 SWAP_SHORTS(buf, len); /* to MAC */
187
188 if ((int)fwrite(buf, sizeof(short), len, f) != len) {
189 return false;
190 }
191
192 SWAP_SHORTS(buf, len); /* back to intel */
193
194 return true;
195}
196
197/**
198 * Load a city file from a given filename and (optionally) directory.

Callers 1

saveFileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected