[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C functions to query Linux file system

Posted on 2009-02-13
2
Medium Priority
?
763 Views
Last Modified: 2013-11-05
How do I get the size of a file on Linux from within a C++ program (compiled with gcc)?  The file to be queried will be only partially written.  Where can I find documentation on similar file system functions?
0
Comment
Question by:DeathByChocolate
2 Comments
 
LVL 9

Accepted Solution

by:
masheik earned 1000 total points
ID: 23633778
Hi,
take this snippet and try it out,
 
int currentFileSize(FILE *inFile)
{
 int sizeinBytes;
 fseek(inFile,NULL,SEEK_CURRENT);
 sizeinBytes=ftell(inFile);
 return sizeinBytes;
}

Open in new window

0
 

Author Comment

by:DeathByChocolate
ID: 23633945
thanks for the answer..  I found the stat() function, which was really what I was looking for.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question