forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Solved] Is Binary File ?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Sun Mar 29, 2009 11:08 am    Post subject: Reply with quote

I think so it's more relivable with the first 500 or 1000 characters.
Thanks for all !
Back to top
View user's profile Send private message Visit poster's website
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Mar 30, 2009 7:01 pm    Post subject: Reply with quote

Dr. Dread wrote:
Dan's code should be quite reliable. But I'm also pretty sure that with VDS this kind of looping
would be sloooow if the file isn't small.
With binary files it would be OK, because the loop will probably find a binary-flagged char quite
soon and exit the loop. But with ASCII files you will loop through the entire file and that means
more than a million loops just for a 1MB file.

So I would suggest that you just do the check for perhaps the first 1000 chars only. Count the loops
and exit if you go beyond that count.

Greetz
Dr. Dread


Hmm IMHO if your breaking out of the loop as soon as you find your first binary byte then I don't think it is going to be that slow. Most so called binary files usually don't have that many printable characters before a non-printable character is found. Also by using the BINFILE or the @NEW() you are not loading the whole file into memory since these use file streams. The only thing that I would do is nest Dan's code inside of code to check the file's extension. If the file does not have an extension that you reconize as a flatfile then do the brute force search of all the bytes in the file.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Mar 31, 2009 6:22 am    Post subject: Reply with quote

dragonsphere wrote:

Hmm IMHO if your breaking out of the loop as soon as you find your first binary byte then I don't think it is going to be that slow.


As I already stated binary files would be OK, but with ASCII files the script will loop through the entire file,
and looping through for instance a 1MB file while calling a number of functions in each loop - that will be a
drag for sure.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group