Solved

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

Posted on 2013-12-11
19
157 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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 45

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
word0 challenge 4 54
Change the path of the data source in my Excel pivot table with macro 4 28
Copy a row 12 53
recursion example 16 70
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

14 Experts available now in Live!

Get 1:1 Help Now