473,657 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1476
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**@NorthStat e.net> wrote in message
news:ed******** *************** *********@4ax.c om...
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\thisfi le.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.


xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxx
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.


xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxx
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.

xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxx
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
9017
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 arbitrary ascii files, to replace Yorick (which I use right now and which is really fast, but not as general as Python). The problem with scipy.io.read_array was, that it is really slow, returns errors when trying to process large files and it...
4
1938
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 pasting the output of a command line "du -s" into some text fields and using that information. As I understand it, for security reasons javascript isn't allowed to do disk input/output. Please correct me if I'm wrong.
2
3223
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
6301
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 of getting wrong it seems I am on very shaky ground . For example, pretty much every book and web course on html that I have read tells me I must include <html>, <head> and <body> tag pairs. I have always done that, and never questioned it. ...
5
5098
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 Partition we are using ReadFile , WriteFile and setFilePointerEx to read and write the sectors and we are reading/writing 102400 sectors together, even we have reduced the sectors still it is not able to read or write, our program is working fine...
9
6811
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> buf(SIZE); fread(&buf, 1, SIZE, f);
12
15657
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 Html File Input control to using the new FileUpload control. Previously, I had set the maxRequestLength attribute in the machine.config file to allow 100MB uploads with success. In the v2.0 application I have added an httpRuntime node to the...
70
1059
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
236
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 on: "This indicates some sort of buffering and caching is going on." but he thinks that the buffering should be discarded when you seek:
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.