How about the deletion function.i just modify the insert function to delete function.is it correct.actualy i would like to delete if 04 FF 04 FF (got repeating value) i would like to delete one of the 04 FF.So can i use the function that i modify .The same thing i wana do as insert function but i wana delete this time the condition is if there is repeating value as i mentioned just now. - Public Function DeleteByte(pmArray() As Byte, pmPosition As Long, ByVal pmNewValue As Byte)
-
' Function to delete a new byte value into a byte array.
-
Dim ArrayStart As Long, ArrayEnd As Long
-
Dim I As Long
-
ArrayStart = LBound(pmArray)
-
ArrayEnd = UBound(pmArray) -1
-
' Expand array to make room for the new value.
-
ReDim Preserve pmArray(ArrayStart To ArrayEnd)
-
' If requested position is outside the array, just stick it
-
' at the start or end as appropriate.
-
If pmPosition < ArrayStart Then
-
pmPosition = ArrayStart
-
End If
-
If pmPosition > ArrayEnd Then
-
pmPosition = ArrayEnd
-
End If
-
' Unless adding to the end of the array,
-
' push everything across to make room.
-
If pmPosition < ArrayEnd Then
-
For I = ArrayEnd To pmPosition -1 Step -1
-
pmArray(I) = pmArray(I - 1)
-
Next
-
End If
-
pmArray(pmPosition) = pmNewValue
-
End Function
36 3508
I don't think the code is quite right. But before we get into the code, I'd like you to try and state fairly simply, the method to be used. In other words, can you describe to me, in a fairly simple overview, how you would go about removing a value from the middle of an array?
Turning it into code is quite simple, and we'll get that done quite quickly. But first you have to understand what you're trying to code.
I'll give you a hint. It's not the same sort of process as inserting. If you start by shortening the array, you've just thrown away whatever was at the end of it.
Actualy are u saying that it is not possible to delete the byte in the middle of array.My problem is now - 04 FF 89 67 87 90 89 04 FF 04 FF
-
89 65 67 78 93 78 78 89 84 67 04
-
i wana delete one of the repeating 04 FF in the array of byte.is it possible in vb?
Actualy when i insert one i have delete one of the 04 FF value in my program
The arrangement of array sometime like 04 FF 04 FF.So when i insert one 04 FF,i should delete one 04 FF.so i have to find the position where should i delete,sowhen there is repeating value like 04 FF 04 FF ,so i wana delete 1 of the 04 FF.So i have to check until EOF to find out the location to be deleted.So i think it will be explain problem more clear.
Certainly it's possible to remove a value from the middle of an array. I'd just like you to think about how you would go about removing one from somewhere in the middle.
You might try thinking of the array as a row of boxes, or something similar. What would be the steps involved in taking one out of the middle and not leaving a gap? If you can explain that in detail, you will be very close to writing the code for it.
(Note, here I'm just talking about the actual removal of a byte. This has nothing to do with deciding what byte to remove.)
-
-
-
04 FF F2 03 37 04 04 FF- F1 03 37 04 04 FF F0 03
-
37 04 04 FF EF 03 37 04 - 04 FF 04 FF EE 03 37 04
-
04 FF ED 03 37 04 04 FF- EC 03 37 04 04 FF EB 03
-
-
For eg i wana find out where the repeating value of 04 FF 04 FF occur,then i wana delete one of the 04 FF
then i wana merge the array. -
-
-
04 FF F2 03 37 04 04 FF - F1 03 37 04 04 FF F0 03
-
37 04 04 FF EF 03 37 04 - 04 FF EE 03 37 04 04 FF
-
ED 03 37 04 04 FF EC 03 - 37 04 04 FF EB 03 89 67
-
-
-
This is i wana do after the insertion and do deletion also.How to start?Wana check until EOF and do deletion as the location where there is repeating structure
You keep jumping ahead. I'm still trying to get you to spell out how you would go about removing a byte from an array. Let's get working tools before we try to use them, huh?
sir so how if u give a function that delete byte from array as u give me as insertion function.Like delete a value from array of byte as starting so that i can understand more[/font]
how to delete a value from a byte of array.like HELLO.i wana delete the 2nd value.How i can do in vb
how to delete a value from a byte of array.like HELLO.i wana delete the 2nd value.How i can do in vb
Now that I think about if further, if you are just looking to replace duplicated strings, I think it will be much simpler to work with a string. You probably won't need the "delete a byte" routine.
Let's assume, for the sake of argument, that you have read your file into string variable strText, instead of a byte array. I think the Replace() function might do the fix for you, all in one go, like so... - Dim strLookFor As String, strChangeTo As String
-
strChangeTo = Chr$(&H04) & Chr$(&HFF)
-
strLookFor = strChangeTo & strChangeTo
-
strFile = Replace(strFile, strLookFor, strChangeTo)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Shea Martin |
last post by:
Which of the following do I use delete instead of just delete.
//1.)
// not sure about this one, as char is of size 1
char *str = new char;
//2.)
//not sure about this one, as it is a primitive
int *array = new int;
|
by: Jonan |
last post by:
Hello,
For several reasons I want to replace the built-in memory management with
some custom built. The mem management itlsef is not subject to my question -
it's ok to the point that I have nice and working allocation deallocation
routines. However, I don't want to loose the nice extras of new operator,
like - constructor calling, typecasting the result, keeping the array size,
etc.
For another bunch of reasons, outside this scope I...
|
by: jeff |
last post by:
how do you convert form byte to Int32 while retaining the binary
value of the byte array
|
by: Richard Arthur |
last post by:
This is a weird problem.
1) I use MediaDet to save a bitmap in a temporary file.
2) I create a bitmap using that temporary file's name.
3) I use the bitmap.
4) I want to destroy the file when the process exits, but I am having
trouble
I have written a Finalizer on the object that actually generates the
bitmaps, as well as implementing IDisposable. The finalizer gets called, I
then call Dispose on each of the bitmaps it the object has...
|
by: Aston Martin |
last post by:
Hi All,
********************** My Situation **********************
I am working on project that involves passing a structure to unmanaged
code from .Net world (well using C#). Perhaps an example will prove
useful.
structure MyStruct
{
// this is a complicated struct declaration in the sense
| |
by: Money |
last post by:
If I allocate memory like this
int *ptr = new int;
Can I apply delete ptr; instead of delete ptr; since I am only
allocating memory for 1 integer.
|
by: Jon Slaughter |
last post by:
Is it safe to remove elements from an array that foreach is working on?
(normally this is not the case but not sure in php) If so is there an
efficient way to handle it? (I could add the indexes to a temp array and
delete afterwards if necessary but since I'm actually working in a nested
situation this could get a little messy. I guess I could set there values to
null and remove them afterwards?
Thanks,
Jon
|
by: kirubagari |
last post by:
is it possible to do deletion in visual basic.
1.04 FF F2 03 37 04 04 FF - FF 03 37 04 04 FF F0 03.....line 1
2.37 04 04 FF EF 03 37 04 - 04 FF 04 FF EE 03 37 04.....line 2
3.04 FF ED 03 37 04 04 FF - EC 03 37 04 04 FF EB 03....line 3
There is repeating data in the above value.How i can delete the repeating value.When i check it out from byte 49 to mfile size there is repeating data 04 FF.How i can use vb to delete the repetating...
|
by: Tristan Wibberley |
last post by:
Hi
I've got implementing overloaded operator new and delete pretty much
down. Just got to meet the alignment requirements of the class on which
the operator is overloaded.
But how does one implement operator new/delete I can't see a way to
indicate, on delete, how many objects must be destroyed (or how big
the space is) - alternatively I can't figure out what are the alignment
requirements so that the implementation, after calling my...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |