?
Solved

Best way to make a file coder?

Posted on 2005-04-26
13
Medium Priority
?
174 Views
Last Modified: 2010-05-02
Hello,

I am going to make a file coder in Visual Basic and I have some questions.
This program will be used to code files up to 4GB filesize and I don't know what would be the best way.

Since Visual Basic is not my best, I've started with a little program which copies the file byte to byte (in next versions, that byte should be coded). But doing it byte to byte it is too slow. Even doing it with strings of 16 bytes it could take up to 2 hours to code a 4GB file. I've tried to do strings of 1000 bytes but when I code around 2GB I get "runtime error 63, registry number incorrect".

Moreover, when I added a progress bar, the program got 5 times slower.

Is this normal? or can anyone give me a tip to make this better? maybe does it get faster in C?
Comments, opinions and help please :)

PS: source and destination files are opened "as binary", is it ok?
0
Comment
Question by:TxEdO
11 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 13870611
Define 'File coder'.
0
 
LVL 2

Expert Comment

by:2Angel
ID: 13870707
Hi,
First, you must know that handle a BIG file is matter of the "machin" (Memory capacity and Proccessor speed).
Second, can you paste the code? How do you "open" the file for binary editing?
0
 

Author Comment

by:TxEdO
ID: 13875036
File coder (in my case): a program to encrypt a file, this file won't be understandable for other programs but the 'file decoder'. For example, I code a JPEG image, and a image viewer won't show the image, you should use the 'file decoder' to decode it, then view it with the image viewer.

The code for opening the file for binary editing:
    Dim str1 As String * 1000 'A number of bytes
    'Dim str2 As String * 1000
    Open source For Binary As #1
    Open destine For Binary As #2
    Do Until EOF(1)
        Get 1, , str1
        'str2 = coding_algorithm(str1)
        Put 2, , str2
    Loop
    Close #1
    Close #2

As I said, if I add a progress bar, it gets like 5 times slower :(
Any idea?
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!

 
LVL 8

Expert Comment

by:wraith821
ID: 13875076
here is an idea... get winzip. use the command line utility, just zip the file with a password and rename it to .dat, maybe the users wont realize what the file is, then you can unzip it when you need to. you could also update the zip file when changes have been made to the file by replacing the file inside the zip file with the new one. might be a little clunky but it would be alot faster.

for the way your doin it...
most people dont have 4gb of memory to put the whole file in so your going to have to do it in chunks. also your chunks need to be 16,32,64,128,256,512,1024,... just to be on the safe side.
0
 

Author Comment

by:TxEdO
ID: 13880865
Using winzip is not acceptable for what i need.
I need to make a complete file coder, the objective of this, is to get a unique password for each user.
0
 
LVL 2

Expert Comment

by:2Angel
ID: 13884909

Hi,

First, try to understand where the problem is. Try to separate the process. Try to open one file and to write it to another file without the encryption. If this process is working fine the try to see where is the problem with the encryption (I don't have the code…).

Second, I don't know for sure, but I think the way you open the file is not the way it should be. Take a look at the links blow:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmopen.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingbinaryfileaccess.asp

http://www.developerfusion.com/show/37/8/

Good luck!
0
 
LVL 2

Expert Comment

by:2Angel
ID: 14406130
Hi,

As you can see I made my best to help and I think I did... but no comment from him...

Tks.
0
 

Author Comment

by:TxEdO
ID: 14420742
I haven't accepted any comment since my problem wasn't solved.

I still get the runtime error when the file size is more than 2 GB.

By the way, sorry for being too late but I was on a travel :)
0
 
LVL 2

Expert Comment

by:2Angel
ID: 14438303
Hi,
Btw, did you to run it on another system? Maybe your system can't handle the file?

Regards.
0
 

Author Comment

by:TxEdO
ID: 14438848
I don't think its a system problem since I have a p4 2.4@800, 512 DDR400

When the filesize is lower than 2 GB the program works fine, but it crashes when its larger than 2 GB
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 14456702
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

749 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