I
I
igoodmood2016-09-13 18:44:48
C++ / C#
igoodmood, 2016-09-13 18:44:48

How to find out the size of a text file in bytes?

Hello! The question arose, you need to find the size of the file, after entering its contents. For example, the program prompts you to enter the contents of a file, the user enters text, and the program shows the size of the file. I tried using the filesize(),filelenght() functions, but that didn't work. Writes that such function is indefinite. Therefore, I ask for your advice to solve this problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2016-09-13
@jcmvbkbc

man 3 ftell

V
Vladimir Martyanov, 2016-09-13
@vilgeforce

For venda: CreateFile() + GetFileSize(), works. Infa 146%. And in your code, try closing the file after writing data to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question