Home > Back-end >  TXT, EXCEL, add data at the end of the CSV file: what happened???????
TXT, EXCEL, add data at the end of the CSV file: what happened???????

Time:11-07

 
Type
Record TCurveData=https://bbs.csdn.net/topics/packed
OneRow: string [250];
end;

//save data
Var
S: a string;
RecFile: file of TCurveData;
RecData: TCurveData;

The begin
S:='zhang';
S:=s + '33.758';
. (a lot of strings)

AssignFile (RecFile, filename);//associated with an external file
Reset (RecFile);
RecData. OneRow:=s;
Seek (RecFile, FileSize (RecFile));//appended
Write (RecFile RecData);
CloseFile (RecFile);//close
end;

//read the data
Var
RecFile: file of TCurveData;
RecData: TCurveData;
CommaStr: TStringList;

The begin
Seek (RecFile, x);//position to the first X lines
Read (RecFile RecData);
CommaStr.Com maText:=Trim (RecData OneRow);
Edit1. Text:=CommaStr [0];
Edit2. Text:=CommaStr [1].
Edit3. Text:=CommaStr [2].
Edit4. Text:=CommaStr [3].
.
end;




The above is my online to find a way, but each time added to the end in the data length is limited, no more than a string [250],
Now I every time want to append a line at the end of 1000 the length of the data, how to do ah,,,,,,,,

CodePudding user response:

Text. Append

CodePudding user response:

reference 1st floor qq_457565758 response:
text. Append


Little xia, can you point in detail, how to add, and then more accurate read oh

CodePudding user response:

Var
TXT: TextFile;
S: a string;
Path: the string;
The begin
Path:=ExtractFilePath (Application. ExeName);
Memo1. The Clear;
AssignFile (TXT, path + '\ test. TXT ");
Append (TXT);//write opens the file pointer to the end
Writeln (TXT, 'is this pig enlightenment can write text);//write a line with line end logo
CloseFile (TXT);

end;

CodePudding user response:

Bad, code has a problem,,

To save the data:
S:='* *' + ', '+' 12312312 '+', '+... ;//there is a comma separated, easy to read read separately,

What I mean is to save time is recorded data type, the largest length is limited, I want to keep a long data to do ah,,,,,,,,,,

CodePudding user response:

Aunt to an aunt

CodePudding user response:

Just read the SPLIT string, baidu has

CodePudding user response:

refer to 6th floor qq_457565758 response:
read the SPLIT string line, baidu has

Good try

CodePudding user response:

TStringList read files in, whatever how long you add a line

CodePudding user response:

refer to eight floor early play play nuclear response:
TStringList read files in, whatever how long you add a line


This seems to be very sharp, but can be some specific ah, I'm a great ah,

S:='* *' + ', '+' 12312312 '+', '+... ;
Save it as a line, for example, and then the next time a similar data save a line (need a newline),
Need to read it,

Big help!

CodePudding user response:

And how to press the row read out, don't know what to do at present, although the Internet looking for an example, but the change is wrong,,,

CodePudding user response:

TXT with tstringlit
Excel with xlswriteread
CVS used

CodePudding user response:

Suggest you still use ADO

CodePudding user response:

Some texts or documents, is preserved in format manner