| |

VerySource

 Forgot password?
 Register
Search
View: 814|Reply: 2

How to set the file length?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-20 18:00:01
| Show all posts |Read mode
I have a file that is 100 bytes long and I want to change it to 50 bytes in length.
Reply

Use magic Report

0

Threads

11

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 Invalid IP Address

Post time: 2020-4-28 14:00:01
| Show all posts
ftruncate
Reply

Use magic Report

0

Threads

63

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-5-4 17:45:01
| Show all posts
#include <unistd.h>
#include <sys / types.h>

int truncate (const char * path, off_t length);
int ftruncate (int fd, off_t length);
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list