I am trying to read a file from C:\Documents and Settings\adam called initials.txt. Because these computers log onto a domain, each person has a folder under C:\Documents and Settings\
My problem is this: If I want to save a text file (used as a config file) into a persons homepath (C:\Documents and Settings\username) how would I do so with Delphi?
In msdos you can access the user path using %homepath%. Can I do something similar in Delphi?, e.g:
Thanks in advance.
------------------------------------
There's no place like 127.0.0.1
------------------------------------
My problem is this: If I want to save a text file (used as a config file) into a persons homepath (C:\Documents and Settings\username) how would I do so with Delphi?
In msdos you can access the user path using %homepath%. Can I do something similar in Delphi?, e.g:
Code:
procedure TForm1.ReadConfig;
var
txtFile : TextFile;
begin
try
try
AssignFile(txtFile, [b]'%homedrive%.initials.txt'[/b]);
Reset(txtFile);
ReadLn(txtFile, strName);
closeFile(txtFile);
except showmessage('error!');
end;
finally
Form1.Caption := strName; //display initials
end;
end;
Thanks in advance.
------------------------------------
There's no place like 127.0.0.1
------------------------------------