Working on a program that needs to open a file, read the contents which is a number, save the content as an integer in the program, edit the number by one and then save in the number in the file once more.
Appjacker
0
Newbie Poster
Recommended Answers
Jump to PostPascal or Delphi? What do you have so far, and where are you stuck?
Jump to PostWhat you posted is Delphi code, but those functions still work. The following is a modified example from Delphi's Help to write a value to a text file:
var F: TextFile; d: Integer; begin d := 1; AssignFile(F, 'C:\check.txt'); Rewrite(F); Writeln(F, IntToStr(d)); CloseFile(F); end;
Jump to PostTry it. You can find lots of examples in the help file.
Jump to Post
Rewrite
sets the file pointer to the beginning of the file for writing. Since you want to read, useReset
.
Jump to PostStep through it with the debugger and see where it fails in your code.
All 20 Replies
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
Appjacker
0
Newbie Poster
Appjacker
0
Newbie Poster
Appjacker
0
Newbie Poster
Appjacker
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Appjacker
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.