How to read VB's udt files?

Just starting out? Need help? Post your questions and find answers here.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

How to read VB's udt files?

Post by Shannara »

In VB you can write a whole UDT into a file. Have anybody have experience in reading the udt files in purebasic?
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

WriteData(FIO, my_udt, sizeof(my_udt)
ReadData(FIO, @my_udt, sizeof(my_udt)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Ah, thanks for the information! :) I didnt know Fred cloned the VB's UDT writing and reading exactly.:) I'll check that out as soon as I get home.
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

UDT PB equivalent is the Structure, whatever language you use, writing structure is always done this way :wink:
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Okay then .. I'll give it a shot to read a vb udt file. If it doesnt work, I'll post both the code for vb and pb :)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

This doesn't work for Strings! Only the useless Pointer is written :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Hehe, well er... Cant be entirely useless as vb must be able to read the string somehow. :)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

You can use FixStrings for that

Code: Select all

Structure test
  text.s{255}
EndStructure

test.test
test\text = "Holla, purebasic rulez"

File = CreateFile(#PB_Any, "C:\test.dat")
If File
  WriteData(File, @test, SizeOf(test))
  CloseFile(File)
EndIf
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Yes, but that wasnt my question that started the thread. I am trying to read a udt file that was created in VB.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Is more the answer to that:
KarLKoX wrote:UDT PB equivalent is the Structure, whatever language you use, writing structure is always done this way :wink:
I haven't VB to test it
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply