Solved

How can ascii 2, 11, 16, 17, 18, 19 be in my text file

Posted on 2013-12-11
19
158 Views
Last Modified: 2014-02-04
I am getting run time error

After investigation I discovered that ascii 2, 11, 16, 17, 18, 19 are in my text file.

For example 1 year ago I saved the following string 3AD3, which is 4 characters length then I discovered that ascii 18 came between A and D so it became 5 characters length.

Of course char 18 can not be seen so it took me long to find out.

How did it get there?

Note that the 3AD3 is not keyed in, it is generated during saving.
e.g. I order my prog to save the number 15059 then it saves it's hex 3AD3

I am suspecting a defect hard drive, a virus, or what?
0
Comment
Question by:saljas
  • 7
  • 6
  • 3
  • +1
19 Comments
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 39711808
Inserting control characters between the bytes of a number that you are saving is very odd behavior indeed. I don't know of any viruses that would do that and I'm not really sure that hard drive errors would do that. Usually corruption from a bad disk or virus will change a byte, but not insert one.

If you think about it, to "insert" a byte on a disk, you would need to shift (copy) everything else over to open up the space for the bad byte.

My guess would be that the program that converts the number to hex and saves it has some issues. I would check that first.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39712295
hex(15059)=3AD3

I suspect you are saving the data in non-textual format and reading it in a hex file viewer.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39712301
What does your file output code look like?
0
 

Author Comment

by:saljas
ID: 39713338
After rechecking similor files I discovered that 3AD3 is not the original number.
The original number was 3A?D3
So, the third char is unknown changed to me, which is replaced by ascii 18.

Also, when I post I was checking a field in the record.  So, after checking the whole record I discovered that many characters were replaced by ascii ( 2, 11, 16, 17, 18, 19 ).

(How do I know it is replaced)
becoming
(Hw do I kno it s relaced)

The following is the code and it is written many years ago

V=12345
Dim Rec As string
Open "Myfile.txt" for output as #1
Rec = "My text" & Hex(V)
print #1, rec
close #1

may be it is beter to replace the harddisk,  or is it a virus
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39714071
what are you using to see the inserted byte?
0
 

Author Comment

by:saljas
ID: 39714146
By this I can tell were is the bad ascii and in which field

For I=1 to Len(mytext)
      AscIs = asc(Mid(MyText,I,1))
      If AscIs < 32    then      List1.additem I & ":>" & AscIs
next
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39714157
please post the code that reads the file as well
0
 

Author Comment

by:saljas
ID: 39714160
I am expecting answers like:-

1- Yes there is a virus called ...... it behavior is adding Lower ascii

or

2- Yes the broken hard disk behavior is adding Lower ascii

Or????
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:saljas
ID: 39714167
dim rec as string
open "MyFile.txt" for input as #1
Do while not eof(1)
  Line input #1, rec
  For I=1 to Len(rec)
      AscIs = asc ( Mid (rec ,I ,1 ))
      If AscIs < 32    then      List1.additem I & ":>" & AscIs
  next
loop
close #1
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39714194
I'm assuming that you have run some AV programs (AVG and Malwarebytes) against your hard drive and found no infections.  Have you looked for a rootkit infection?

The next step is to use a different media.  Insert a thumb drive and do your write/read test to the thumb drive.  If the problem is seen in this test, then we can rule our a problem with the hard drive.

Do me a favor and add an Option Explicit statement to your General Declarations section.  This will force you to declare all your variables.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 39714213
1- Yes there is a virus called ...... it behavior is adding Lower ascii
2- Yes the broken hard disk behavior is adding Lower ascii

But remember, inserting bytes in the middle of other bytes is not something that disk errors can do because it would need to shift everything. Viruses don't do that either. It's just a lot harder than other ways to mess things up.

If you saw 3A D3 37 turn into 3A 18 37, then it would make sense to be a disk error.

What you are seeing must be happening when the data is being written or when it is being read. That's why we are asking to see how that happens.


The original number was 3A?D3
Ah. Now that makes some sense. That's not the ASCII '?' character. That's how it is choosing to display non-printable characters. I'll bet anything below 32 is displayed as a ?. What are you opening it in to see the question mark?
0
 

Author Comment

by:saljas
ID: 39718346
TommySzalapski,
 in the first post I wrote
Of course char 18 can not be seen so it took me long to find out.
So I am adding "?" for explanation

aikimark
The file contains 56000 records, the prog is working since 2001
The problem happened in 20 records above 55100
If it is Explicit problem then it would appear in the last 12 years with 55000 records.
Also it is not a steady problem that happens for every record, so I might test on a new media without getting a firm answer.

And,
Since this is a customer's computer then I'll investigate the RootKit or any other infections.

I thought that there is a virus or malware or .... that causes char replacement

Many thanks for both of you
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 39718382
Oh, I just realized what you meant.
" I discovered that 3AD3 is not the original number. The original number was 3A?D3
So, the [middle] char is unknown changed to me, which is replaced by ascii 18."

So the middle byte there got changed from whatever it was to 18.

Now that makes sense and sounds like any number of possible disk errors or viruses.

Certainly run virus scans on the computer if you haven't already and disk checks too. Either run chkdsk or if you prefer user friendly things, follow these instructions
http://windows.microsoft.com/en-us/windows-vista/check-your-hard-disk-for-errors
(right click on C:\, click 'properties', click 'tools' tab, click 'Check now...' under 'Error checking')
0
 

Accepted Solution

by:
saljas earned 0 total points
ID: 39762437
many thanks for every body
Please close my question
0
 

Author Comment

by:saljas
ID: 39765562
how to close without accepting
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39765841
how to close without accepting
Is your problem solved?  If so, what comment states the solution?  

If you solved the problem yourself, then accept your comment that describes the solution.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39831985
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 79
HOW D I CLEAR PICTURES IN IMAGE CONTROL AND COMMENTS IN CELLS WHEN WORKBOOK IS OPENED 18 84
Device same like our heart 12 77
Advice in Xamarin 21 56
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now