Solved

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

Posted on 2013-12-11
19
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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 47

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

735 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