Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8576877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:01:42+00:00 2026-06-11T20:01:42+00:00

i have a file hello.txt and a pointer *i pointing to the file, i

  • 0

i have a file hello.txt
and a pointer *i pointing to the file, i have opened the file using c open(*i) function. i want to get the size of file using getpagesize(2) to read the content of the file and further write that content to a destination file. so getting the size of the file i required to now how big is the file and how much content there is to read.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:01:43+00:00Added an answer on June 11, 2026 at 8:01 pm

    If you are using the open system function to open the file, you should look into the fstat function to get the size:

    int fd = open(...);
    
    struct stat st;
    fstat(fd, &st);
    
    printf("File size: %ld bytes\n", st.st_size);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to read a file called hello.txt using the following code on java/eclipse/android:
i have a file named hello.txt which has the content Hello,there!. I want to
I have a template file( template.txt ): Hello, $x Hello, $y I have a
I have a file template.txt which contains the following: Hello ${something} I would like
so i have ruby script that simply writes to a test.txt file with hello
Hello I have a problem wherein I have to read a huge csv file.
Hello every one I want to ask a question about file transfer using sockets.
Well, I have a file test.txt #test.txt odsdsdoddf112 test1_for_grep dad23392eeedJ test2 for grep Hello
I have a file abc.txt with contents like: hello hi good bad ... ....
i have a file myfile.txt that have the next content: hola mundo hello word

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.