Ivax,<br><br>Could we have a bit more detail please?<br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href=
I have a type like this<br>type client<br> codbar as string(13)<br> client as string(6) <br> name as string(40)<br>endtype<br><br>and when i write it to disk using Put it makes something like:<br><br>13 1029837493827Mike<br><br>and i like write<br> 131029837493827 Mike<br><br><br>
Could you do something like this?<br><br><FONT FACE=monospace><b><br>.name = "Mike"<br><br>while(length(.name) < 40)<br> .name = " " & .name<br>wend<br></font></b><br><br>Yuk, not very elegant, can someone else do better? <grin> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href=
Hmmm, maybe.<br><FONT FACE=monospace><b><br>Private Type MyClient<br> codbar As String * 13<br> client As String * 6<br> name As String * 40<br>End Type<br>Dim Client As MyClient<br><br>RSet Client.name = "Mike"<br></font></b><br>Rset right-aligns one string in another string.<br>Visual Basic documentation claims that you can't use it with a user defined type like "Client". <i>Funny</i>, you know, it just worked for <i>me</i>. <br><br><br> <p> <br><a href=mailto: > </a><br><a href=
Ivax,<br><br>Not sure... tried it at home and it seems to work. Like you, defined a UDT in a module then created a new variable based on the UDT in my form<br><br>ie.<br>Option Explicit<br><br>Public Type client<br> codbar As String * 13<br> client As String * 20<br> name As String * 40<br>End Type<br><br>Then in the form_load I put <br><br>Dim myclient As client<br><br>Open "c:\test.txt" For Random As #1<br><br>With myclient<br> .codbar = 13<br> .client = "123456789"<br> .name = "Test"<br>End With<br><br>Put #1, , myclient<br><br>opened it in wordpad and in DOS and it looked correct that is to say, that the codbar was 13 bytes, client was 20 bytes and the name was 40.
Interesting 'soloutions', I don't understand the need to do the alignment for the text file written to Disc. Could someone please explain this part to me? I am obviously missing some point.<br><br>Michael
Micheal,<br><br>Sometimes it is usefull to have a fixed length text file where all the records are consistent in length. The other option would be to have a variable length file but then you would have to have a delimiter at the end of each field. Either way works fine. The delimiter method generally is the better approach when dealing with large text files as it will save tons of space in the long run. But to each their own.<grin><br>
I'm with Micheal. ivax is using put, therefor is this not a random-access file? Then why would you want to read it using a text editor. Whatever class object you write it with will read it.<br>Huh :~*<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.