Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question Formatting a Linux partition


    I have the need to be able to programatically format a thumb drive having a single Linux partition on it using C/C++. What function call(s) do I need to make in order to get this done ?

    I want to format the partition using a default partition type of my choosing if the partition has not yet been formatted. Otherwise I want to reformat the partition with the same partition type it already has. I know how to programatically mount or unmount the thumb drive to a path. What I do not know are the details of the functionality for formatting or reformatting the partition of the thumb drive.

    Any help in this area would be welcome. I am an experienced C++ programmer, but have not dealt with this functionality on Linux before.

  2. #2
    Linux User
    Join Date
    Dec 2017
    Location
    Argentina
    Posts
    271
    I don't know how, but...

    Maybe you should explore the code of software that does it.

    GNU Parted is written in C. You can find the source code here: GNU Parted - Summary [Savannah]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •