473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Simplest way to read size of file on disk from Access 2.0 code?

MLH
I want to be able to read the file
size of my config.sys file or other
file from withing Access Basic
module. I'm sure its already been
done. Don't wanna reinvent wheel
or lug nuts, etc.
Nov 13 '05 #1
6 1464
I don't believe Access 2.0 had the FileLen function that subsequent version
have. I think there was an API call that could do it, but unfortunately I
don't have a 16 bit API reference anymore.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"MLH" <CR**@NorthState.net> wrote in message
news:ed********************************@4ax.com...
I want to be able to read the file
size of my config.sys file or other
file from withing Access Basic
module. I'm sure its already been
done. Don't wanna reinvent wheel
or lug nuts, etc.

Nov 13 '05 #2
MLH
<snip>
I don't believe Access 2.0 had the FileLen function that subsequent version
have. I think there was an API call that could do it, but unfortunately I
don't have a 16 bit API reference anymore.


Darn. Just my luck. I looked all through the TA Code Tools. If there
had been an API fn call to return something line FileLen in the 16-bit
library - they would probably have know it. I suppose I'll have to
rely on some junky way like running a command line...

dir c:\mydir\thisfile.txt > 1234567890.txt

then pull in 1234567890.txt & parse it out. THat's about the suckiest
way I can think of to do it. Maybe that's all there was.
Nov 13 '05 #3
MLH
<SNIP>
I don't believe Access 2.0 had the FileLen function that subsequent version
have. I think there was an API call that could do it, but unfortunately I
don't have a 16 bit API reference anymore.


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Well, even a blind hog...

Open "c:\mydir\data.fil" For Binary As #1
FileSize = LOF(1)
Close #1
MsgBox CStr(FileSize)

Nov 13 '05 #4
MLH
>I don't believe Access 2.0 had the FileLen function that subsequent version
have. I think there was an API call that could do it, but unfortunately I
don't have a 16 bit API reference anymore.


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Well, even a blind hog can find an acorn sometimes...

Open "c:\mydir\data.fil" For Binary As #1
FileSize = LOF(1)
Close #1
MsgBox CStr(FileSize)

Nov 13 '05 #5
MLH wrote:
I don't believe Access 2.0 had the FileLen function that subsequent version
have. I think there was an API call that could do it, but unfortunately I
don't have a 16 bit API reference anymore.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Well, even a blind hog can find an acorn sometimes...

Open "c:\mydir\data.fil" For Binary As #1
FileSize = LOF(1)
Close #1
MsgBox CStr(FileSize)


You'd best check it exists first with the Dir() function as opening in
binary mode will create the file if it doesn't and return 0 bytes,
either that or open the file for input.

Another tip is that some other process may have the file open, since all
you want to do is get the size of the file that shouldn't bother you but
the i/o open command opens it with an exclusive lock unless otherwise
specified, e.g.
open "file" for binary access read shared as #1

Bummer if the file is over 2GB though :-)

--
[Oo=w=oO]

Nov 13 '05 #6
MLH
<snip>
You'd best check it exists first with the Dir() function as opening in
binary mode will create the file if it doesn't and return 0 bytes,
either that or open the file for input.

Another tip is that some other process may have the file open, since all
you want to do is get the size of the file that shouldn't bother you but
the i/o open command opens it with an exclusive lock unless otherwise
specified, e.g.
open "file" for binary access read shared as #1

Bummer if the file is over 2GB though :-)


Thx Trevor. I read the filesize immediately after creating the binary,
logging its (ever growing) size into an archive table.
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Sebastian Krause | last post by:
Hello, I tried to read in some large ascii files (200MB-2GB) in Python using scipy.io.read_array, but it did not work as I expected. The whole idea was to find a fast Python routine to read in...
4
by: Cloud Burst | last post by:
I'm writing a javascript for my own use. I'd like it to read my disk to get some information. In particular, I want to find out how much disk is being used by some directories. At present, I'm...
2
by: Jim Richards | last post by:
I have been told by a local PC club technician that 98SE cannot read NTFS drives in a network. Is this true? TIA, Jim.
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
5
by: Sumana | last post by:
Hi All, We developed our project on VC++.Net console application to create image of disk and to write the image We are having problem with reading and writing the sector beyond 6GB Disk or...
9
by: sshock | last post by:
Hi all, I want to read from a file into a vector<unsigned char>. Right now my code looks like this: FILE* f = fopen( "datafile", "rb" ); enum { SIZE = 100 }; vector<unsigned char>...
12
by: Phil Z. | last post by:
After migrating an ASP.NET 1.1 application to 2.0 we were getting "Cannot access a closed file" errors when uploading. I found a number of post on the subject and have since moved from using an...
70
by: quickcur | last post by:
hi can anyone explain me to read image to memory from a url it is very easy in java but it is hard to find an complete solution in c/c++. Thanks,
1
by: Steven D'Aprano | last post by:
On Wed, 22 Oct 2008 16:59:45 -0400, Terry Reedy wrote: With respect Terry, I think what you have missed is the reason why the OP thinks this is a bug. He's not surprised that buffering is going...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.