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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Q: How can I read out the file size?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hajo_old Posted - 04/02/2003 : 09:47:04 AM
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
3   L A T E S T    R E P L I E S    (Newest First)
hajo_old Posted - 04/03/2003 : 03:08:30 AM
Thanks all
it works now!

Hajo

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

SVDO_Origin1
srmcarneir Posted - 04/02/2003 : 3:15:50 PM
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
Mike Buess Posted - 04/02/2003 : 10:17:45 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000