Reason your iBytesRead didnt work is because it wasn't an Int, but a GC Pointer to an int, hence why the cast makes it work (in plain C++ you'd have a int *iBytesRead; and then to use the value you'd have to dereference it like int x = *iBytesRead; )
For your filestream issue - your download location is a folder but you don't specify a filename from what i can see. Try tacking on a filename