[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 279

 

Good evening all!

I have a simple question, how to put a discriptor in the file, not at the end of FileSeek(p,0,SEEK_END);, but at the end of the last written line?

 
BBSL:

Good evening all!

I have a simple question, how to put a discriptor in the file, not at the end of FileSeek(p,0,SEEK_END);, but at the end of the last written line?

In the help, what do they write about it? Is there such a function or constant?
 
BBSL:

Good evening all!

I have a simple question, how to put a discriptor in the file, not at the end of FileSeek(p,0,SEEK_END);, but at the end of the last written line?


Usually, after a line is written, the descriptor is there.
 
artmedia70:

Here's a script to test it:

I'll check with Victor in which sauna and on which island we are going to relax... :)))))))))




The script is running. Thank you.

Result: outputs bar numbers with arrows, but writes that buffer values = 0.0000000

Herewe go!!!

.........................................

I'll save it for later. That's enough for today.

 
sergeev:
What does the help say about it? Is there such a function or constant?


Hello sergeev!

There is FileIsLineEnding in the help...

There's also an end-of-line sign...

 
Roger:

Usually, after a line is written, the descriptor is there.

Well, yes, but when you close the file and then open it, by executing FileSeek(p,0,SEEK_END); you have it on a new line, no? You need to put it on a previous line... Maybe you need to specify an offset, e.g. -1 in FileSeek...
 
BBSL:
You should be on the previous one...

Thank you, that's funny.) Why not the next one? Let's write functions for each line.
 
BBSL:


Hello sergeev!

There is FileIsLineEnding in the help...

There's also a line end indication...

This is the only option then. Read the lines by checking this function.
 
Roger:

Thank you, that's funny :-) Why not on the next one? Let's write functions for each line.

What does this have to do with functions?) How to move the descriptor? It is clear that most likely we will shift FileSeek();, but maybe someone has already done it and have a bit of code at hand))
 
BBSL:

What's it got to do with the functions?) How to move the descriptor? It is clear that we will most likely move it with FileSeek();), but maybe somebody already did it and have a bit of code at hand))


You can try the following way

int handle;
  string str;
  handle=FileOpen("filename.csv", FILE_CSV|FILE_READ);
  while(!FileIsEnding(handle))
    {
     str=FileReadString(handle);
     
    }
  FileClose(handle);
FileSeek(handle, StringLen(str), SEEK_END);
Honestly, I haven't tried it myself.