Why would WriteBytes() cause an error?
BlitzMax Forums/BlitzMax Programming/Why would WriteBytes() cause an error?
| ||
#WriteBytes writes @count bytes from the memory block specified by @buf to the stream. If @count bytes were not successfully written, a #TStreamWriteException is thrown. This typically occurs due to end of file. stream=Writefile(path) stream.writebytes buf, length It should just resize the stream and keep writing, shouldn't it? Does this indicate a problem with the stream of is my data pointer invalid? |
| ||
what exactly is being thrown? a write exception or another kind of exception? Generally when I've had problems with streams it's been with my data (e.g. are you sure you're buffer is correct, and length is appropriate?). also check that the stream exists before trying to write (to ensure it opened correctly... can't open a write stream to a read only file for example... permissions etc. do other write commands to the stream work? |
| ||
Bear in mind this works for socket connections, too, so if the stream goes down... A USB drive could also be the target and get brutally yanked, or a hard drive might simply get filled. |
| ||
Yep, it was my data. |