| Author |
Topic  |
|
|
hajo_old
Germany
141 Posts |
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 |
|
|
Mike Buess
USA
3037 Posts |
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 |
 |
|
|
srmcarneir
Brazil
33 Posts |
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 |
 |
|
|
hajo_old
Germany
141 Posts |
Posted - 04/03/2003 : 03:08:30 AM
|
Thanks all it works now!
Hajo
-- -- Dipl.-Ing. Hans-Joerg Koch Siemens VDO, Regensburg
SVDO_Origin1 |
 |
|
| |
Topic  |
|