Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Send net files?

Author
Message
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 13th Jan 2010 16:07
Hi

How do you send net files?

Thanks, TheComet


Make the paths of your enemies easier with WaypointPro!
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 13th Jan 2010 17:20
Load the files as a memblock, send the memblock, then save the memblock as a file on the other end. That would probably work.

Enjoy your day.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 13th Jan 2010 21:47
I was looking for a way to turn files into memblocks, but I couldn't find any command... Is there a command?

TheComet


Make the paths of your enemies easier with WaypointPro!
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Jan 2010 17:34
MAKE MEMBLOCK FROM FILE File Number, Memblock Number

Enjoy your day.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th Jan 2010 20:16
Thanks Latch!

But I found I can't re-assemble the memblock to a file again, because there is no MAKE FILE FROM MEMBLOCK command...

It is going to be a real hassle to write everything to a file, because the file contains images, sounds, and a mixture between bytes, words and floats...

Is there an easier way?

TheComet


Make the paths of your enemies easier with WaypointPro!
Double B
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 25th Jan 2010 23:51
Try to see if you can convert that image and sound data to and from string, integer or real variables. Using memblock commands, you can get the entries at every location of data in the image or sound and send it as a variable. By the way, is your waypoint plugin done yet?
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 26th Jan 2010 00:40
There's a WRITE MEMBLOCK File Number, Memblock Number command. I the first 4 bytes stored are the size of the memblock, so you'd have to deal with that.

The other option is just to open a file and write all of the bytes from the memblock to the file:

fn=1
open to write fn,"myfile.bmp"
for n=1 to get memblock size(mem)
write byte fn,memblock byte(mem,n-1)
next n

If you use a single memblock to store multiple files at once, then use separators or headers between files or create a custom header that identifies the positions and length of each file type within the memblock. Then open the proper file and write the specific bytes to it.

If you are writing a memblock to a file, you only have to worry about writing bytes. You don't have to write dwords, floats or anything else. The bytes cover all the bases.

Enjoy your day.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Jan 2010 09:06
Thanks Latch! WRITE MEMBLOCK sounds good, I'll give it a go. Thanks a lot everyone for there help!

Quote: "By the way, is your waypoint plugin done yet?"


Actually it was canceled... I may pick it up later, but it's far away in the future... If you'd like to take over, then be my guest!

TheComet


Make the paths of your enemies easier with WaypointPro!

Login to post a reply

Server time is: 2024-04-26 08:47:00
Your offset time is: 2024-04-26 08:47:00