MCPcopy Create free account
hub / github.com/anjo76/angelscript / CBytecodeStream

Class CBytecodeStream

sdk/samples/asbuild/source/main.cpp:219–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219class CBytecodeStream : public asIBinaryStream
220{
221public:
222 CBytecodeStream() {f = 0;}
223 ~CBytecodeStream() { if( f ) fclose(f); }
224
225 int Open(const char *filename)
226 {
227 if( f ) return -1;
228#if _MSC_VER >= 1500
229 fopen_s(&f, filename, "wb");
230#else
231 f = fopen(filename, "wb");
232#endif
233 if( f == 0 ) return -1;
234 return 0;
235 }
236 int Write(const void *ptr, asUINT size)
237 {
238 if( size == 0 || f == 0 ) return 0;
239 fwrite(ptr, size, 1, f);
240 return 0;
241 }
242 int Read(void *, asUINT) { return -1; }
243
244protected:
245 FILE *f;
246};
247
248int SaveBytecode(asIScriptEngine *engine, const char *outputFile)
249{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected