|
-
Oct 9th, 2002, 09:44 PM
#1
Thread Starter
Frenzied Member
C++ File I/O???
How much faster is c++ file I/O than VB's?
Would it make a program alot faster if i wrote a dll file in c++ to read a file into array so that vb can access it. If it is faster is there a tutorial that would help me learn how to do this. or could some one post a example?
Thanx <ABX!
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Oct 9th, 2002, 10:11 PM
#2
Frenzied Member
You shouldnt be reading or writing to a file very often (unless you are writing some sort of specialized database), so the speed really doesnt matter. In reality, both are calling the Win API, so the speed difference is negligable.
Z.
-
Oct 9th, 2002, 10:21 PM
#3
Thread Starter
Frenzied Member
How about Reading a 200kb text file into a array
I thought c++ was suspose to be alot faster for file access?
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Oct 9th, 2002, 11:35 PM
#4
Thread Starter
Frenzied Member
I Guess C++ Forums not as busy as vb???
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Oct 10th, 2002, 04:50 AM
#5
Monday Morning Lunatic
Originally posted by <ABX
How about Reading a 200kb text file into a array
I thought c++ was suspose to be alot faster for file access?
It's faster for the actual processing on that data, in most cases.
I wouldn't worry about it.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 10th, 2002, 10:06 AM
#6
Frenzied Member
I/O speeds are related far more to hardware than the language.
A disk with high latency, slow rotation, and lots of fragmentation is far more of a problem.
CPU and primary bus throughput speeds (software) are usually 100 - 1000 times faster than disk i/o. This is why most disks have 1-10MB+ of onboard cache. It's essentially a readahead buffer. If you want to maximize the use of the cache read the entire file at once then close it. This is only going to help with large files. This is because Windows has a RAM cache of usually 64kb for all open files. This will handle little files - the disk cache is meant for biggies.
VB code (sorry not C++)
Code:
dim tmp() as string
dim a as string
open "myfile.txt" for binary as #1
a= space(LOF(1))
get #1,,a
close #1
tmp=split(a,VbCrLf)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|