The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Q: How can I read out the file size?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hajo_old

Germany
141 Posts

Posted - 04/02/2003 :  09:47:04 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello, all

how can I read out the file size of a spezified file by using OriginC (or maybe LabTalk) ??

(Maybe a new feature for global File I/O or the file class ?!)

Thanks
Hajo

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1

Mike Buess

USA
3037 Posts

Posted - 04/02/2003 :  10:17:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hajo,

In Labtalk...

exist("file path\name")=; // returns file size in KB


In OriginC...

string strFile = "file path\name";
long fSize;
file ff;
ff.Open(strFile,file::modeRead);
fSize = ff.SeekToEnd(); // size in bytes
ff.Close();

-or-

string strFile = "file path\name";
long fSize;
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
GetFileAttributesEx(strFile, 0, &fileInfo);
fSize = fileInfo.nFileSizeLow; // size in bytes


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 04/02/2003 10:18:18 AM
Go to Top of Page

srmcarneir

Brazil
33 Posts

Posted - 04/02/2003 :  3:15:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hajo, Mike, All,

Sometimes Origin C help files seem not to be as complete as
one could wish. Then it is useful to look into those header
files provided by the language, for instance "mswin.h" where
struct WIN32_FILE_ATTRIBUTE_DATA suggested by Mike came from.

It is amazing that we can find some examples there also.
That adds plenty of extra help to Origin C documentation.

Regards,

Ricardo Carneiro
Go to Top of Page

hajo_old

Germany
141 Posts

Posted - 04/03/2003 :  03:08:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks all
it works now!

Hajo

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000