Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Truncating size of file using _chsize()

Truncating size of file using _chsize()

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nikesh Jagtap
    wrote on last edited by
    #1

    For trancating file size using: int _chsize( int fd, long size); require to provide parameter "int fd" i.e. file descriptor. How to provide file descriptor?

    C _ 2 Replies Last reply
    0
    • N Nikesh Jagtap

      For trancating file size using: int _chsize( int fd, long size); require to provide parameter "int fd" i.e. file descriptor. How to provide file descriptor?

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      There's a complete example in the documentation[^]

      Cédric Moonen Software developer
      Charting control [v3.0] OpenGL game tutorial in C++

      1 Reply Last reply
      0
      • N Nikesh Jagtap

        For trancating file size using: int _chsize( int fd, long size); require to provide parameter "int fd" i.e. file descriptor. How to provide file descriptor?

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        If you have a handle to a file, you can do the same using the SetFilePointer and SetEndOfFile APIs.

        «_Superman_»
        I love work. It gives me something to do between weekends.

        Microsoft MVP (Visual C++)

        Polymorphism in C

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups