| |

VerySource

 Forgot password?
 Register
Search
View: 1416|Reply: 13

Reading and writing files

[Copy link]

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-1-2 20:20:01
| Show all posts |Read mode
I call dos to generate a txt file, how to read a certain data
int main ()
{
   system ("dir e:\\>> 1.txt");
   system ("pause");
   return 0;
}

Generate a file as follows:
 The volume in drive E has no labels.
 The serial number of the volume is 2415-BC8C

 E:\'s directory

2006-12-30 14:45 0 1.txt
2006-12-30 14:38 <DIR> lrc
2006-12-17 19:58 <DIR> mhpa
2006-12-16 14:29 <DIR> netgame
2006-08-15 08:52 <DIR> soft
2006-06-15 13:05 <DIR> update
               1 file 0 bytes
               5 directories 918,061,056 bytes available

I want to call the byte "918,061,056" of the remaining disk space in another file. How can I achieve this?
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-2 20:21:01
| Show all posts
Read file contents line by line
Use string manipulation to convert
Specifically continue to look at file pointers and string operations
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-2 20:39:01
| Show all posts
Can you help me write a program example? I know it can be read line by line. But if I only want to take one of them, can I? consult! !!
Reply

Use magic Report

0

Threads

63

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-3 09:54:01
| Show all posts
Get the last line, then skip whitespace and TAB
Reply

Use magic Report

0

Threads

1

Posts

1.00

Credits

Newbie

Rank: 1

Credits
1.00

 China

Post time: 2020-1-3 11:39:04
| Show all posts
what do you want to say
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-3 15:03:02
| Show all posts
Can you write it? I wouldn't. I've looked for books, but I haven't touched on this issue. .
Reply

Use magic Report

0

Threads

24

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-1-5 11:57:01
| Show all posts
Don't know to take the last line
Then atol
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-5 16:21:01
| Show all posts
What is atol?
Can you explain it specifically?
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-6 07:54:01
| Show all posts
It is estimated that the ultimate purpose of the landlord is to obtain the amount of free disk space. You can use other methods to get the properties of the disk.
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-6 18:57:01
| Show all posts
Yeah, yeah, I found it, they taught me to use the API pipeline, but I have n’t read those books, I can replace it with what I will use now, and I will improve it in the future! !! But I can't make it with this now! !!
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