For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > February 2005 > Delete a field in a random access file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Delete a field in a random access file
Pykardo

2005-02-04, 4:01 pm

Hi!, i'm looking for a way to delete a certain field from a random access
file, but can't find any function that can accomplish this... maybe i search
with eyes of a woman so i didn't find it but any1, u would be very helpful if
some1 knew! thanks a lot
Bob Butler

2005-02-04, 4:01 pm

"Pykardo" <Pykardo@discussions.microsoft.com> wrote in message
news:BCED9AE2-157E-4D18-BDB3-7AA9830762CE@microsoft.com
> Hi!, i'm looking for a way to delete a certain field from a random
> access file, but can't find any function that can accomplish this...


What do you mean by 'delete'? You can overwrite the data or you can shift
all following data up and truncate the file but you can't just delete bytes
out of the middle of a file.

> maybe i search with eyes of a woman


That comment's going to get you into trouble!

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Pykardo

2005-02-04, 4:01 pm

I meant to truncate... i made a way to shift the data by reading it then
puting it back to the position before him, maybe there's an easier way to do
that, but i find it easy. The only part i bug is how to truncate that final
data that i don't need anymore.

i'll try not get me in trouble ;)

"Bob Butler" wrote:

> "Pykardo" <Pykardo@discussions.microsoft.com> wrote in message
> news:BCED9AE2-157E-4D18-BDB3-7AA9830762CE@microsoft.com
>
> What do you mean by 'delete'? You can overwrite the data or you can shift
> all following data up and truncate the file but you can't just delete bytes
> out of the middle of a file.
>
>
> That comment's going to get you into trouble!
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
>

Khai

2005-02-07, 4:08 pm

Proposed solution:
A) open PrimaryFile for Random read access
B) open OutFile for Random write access
C) loop through PrimaryFile loading records
D) assign the values from the Primaryfile.record to a outfile.record type
E) write to Outfile
F) repeat at C til last PrimaryFile.record has been read.

-Khai

"Pykardo" <Pykardo@discussions.microsoft.com> wrote in message
news:375722C3-87EB-47AB-96EA-574854D37300@microsoft.com...
> I meant to truncate... i made a way to shift the data by reading it then
> puting it back to the position before him, maybe there's an easier way to

do
> that, but i find it easy. The only part i bug is how to truncate that

final[color=darkred]
> data that i don't need anymore.
>
> i'll try not get me in trouble ;)
>
> "Bob Butler" wrote:
>
shift[color=darkred]
bytes[color=darkred]


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com