Home > Delphi Unable > Delphi Unable To Write To Inifile

Delphi Unable To Write To Inifile

Ini := TIniFile.Create(ChangeFileExt('StudentALevelMathsTracker.exe','.ini')) ; try Ini.WriteString('Settings', 'FilePath', edtFilePath.text); Ini.UpdateFile; finally Ini.Free; end; However when I run this I get an error saying Project ALevelMathsTracker.exe raised exception class EIniFileException with message 'Unable You might also enjoy: Sign up There was an error. Legal in 36 states and overseas. http://www.bitlogic.co.uk/development.htm Quote"Brian Cook" wrote in message news:[email protected] his comment is here

share|improve this answer edited Sep 11 '11 at 11:35 answered Sep 11 '11 at 10:21 David Heffernan 439k27604981 Do you know of any online tutorials relating to the use Go to Start > Run > Type cmd 2. The question is, where is the ini-file supposed to be stored? Sever-sort an array Why did Vader dislike Krennic? additional hints

Bayes regression: how is it done in comparison to standard regression? Password Register FAQ Community Calendar Today's Posts Search Community Links Social Groups Pictures & Albums Search Forums Show Threads Show Posts Advanced Search Go to Page... If you do switch to TMemIniFile then remember to call UpdateFile before destroying the ini file since this is what will save the settings to the disk. Thank you,,for signing up!

Although it worked in the past, it has never been a good practice. const sIniPath = 'p:\PREVIEW.INI'; WritePrivateProfileString( nil, nil, nil, sIniPath ); try With TIniFile.Create(sIniPath) do try try WriteInteger('Zoom', Something is sending a false message. WritePrivateProfileString( nil, nil, nil, PChar('p:\PREVIEW.INI') ); Like this...

Here's some code for getting the proper folder for your .INI file: uses Windows, ShlObj; // For SHGetSpecialFolderPath function GetFolderLocation(Handle: HWnd; Folder: Integer): string; begin Result := ''; SetLength(Result, MAX_PATH); if All Rights Reserved. However, as others have said, it does sound like a security issue. I believe there are bugs in the private profile API that lies behind it. –David Heffernan Sep 11 '11 at 10:39 @Andreas My instinct is that peter is not

Join our community for more solutions or to ask questions. I think it will end up in the same dir as the EXE (or a virutal-store folder). –Andreas Rejbrand Sep 11 '11 at 10:54 3 TIniFile.Create('some.ini') is created in Windows Regards, Madshi. 0 LVL 6 Overall: Level 6 Delphi 5 Message Expert Comment by:Stuart_Johnson ID: 69004652002-03-27 Madshi, >33 = The process can't access the specified file, >because another process has http://www.bitlogic.co.uk/development.htm Quote"Anne Sainz" wrote in message news:[email protected]

Such strange access rights are possible, though unprobable... Field 'MyField" not found2. The problem ended up being that the clown who setup Terminal Server forgot to setup the user's home directory. I am sure no one else is using the same inifile. 0 LVL 20 Overall: Level 20 Delphi 18 Message Expert Comment by:Madshi ID: 68992922002-03-27 Perhaps you should try a

Thanks in advance. this content If that works, then I'm stumped. I do have windows xp, but when I follow the steps I don't seem to have the same things to go by. Someone is evidentally still programming Pascal even if I am not3.

One way to solve the problem is to write your own version of the ReadSection method.Check ut "where should I store my application's data". this will create a new ini file. try Ini.WriteString('Settings', 'FilePath', edtFilePath.text); Ini.UpdateFile; except on EIniFileException do begin // This will raise an EOSError Exception with a better message. weblink However, I strongly recommend that you consider using TMemIniFile rather than TIniFile since TMemIniFile avoids all the pitfalls of the private profile API.

Clearly you should fully qualify your path. The problem only occurs with Win2000. Can't you use the registry?

Bhd.|powered by LiveHelpNow Help Desk Software Total articles: 1048 | Total views: 621494 Live Chat Support Software Board index » delphi » ini files, text files and XP Anne Sain

Regards, Madshi. 0 Message Author Comment by:ble ID: 69153062002-04-03 I found the problem. Remove frmMain, and just use Close. Related 3Universal approach for storing INI-type settings and/or DB files on various Windows machines4Delphi ini file vista/xp/win77Ini Files - Read Multi Lines?0Reading ini file onCreate event causes 8 second delay0Delphi - That would lead me to believe that it isn't a true rights issue.

Perhaps that works better. Join Now For immediate help use Live now! Quote"Anne Sainz" wrote in message news:[email protected] http://tubee.net/delphi-unable/delphi-unable-to-locate-component.html Anyone know what the problem could be?

Anne carlo Delphi Developer Sat, 13 Aug 2005 01:09:12 GMT Re:ini files, text files and XP It is not a good idea to create objects from within a FormClose event (You You have either misdiagnosed the problem (are you sure that everything really works out if you rename the INI in the line shown above?), or, perhaps, you already have a file Does a byte contain 8 bits, or 9? I am using the following code: var ini: tinifile; begin ini := tinifile.create('.\test.ini'); ini.WriteString('section','key','value'); ini.free; I have also tried your way with WritePrivateProfileString: writeprivateprofilestring(nil,nil,nil,'.\test.ini'); writeprivateprofilestring('section','key','value','.\test.ini');

Connect with top rated Experts 19 Experts available now in Live! But take care if you have write permission in the application folder –Sir Rufo Mar 18 '14 at 11:22 2 Well, I guess the error message is pretty clear! I think the OP will find out that no file is created even if he replaces the mafia-inspired name by the slighly more dull 'myapp.ini'. –Andreas Rejbrand Sep 11 '11 at By writing into the registry the settings are stored only on one workstation. 0 LVL 20 Overall: Level 20 Delphi 18 Message Expert Comment by:Madshi ID: 68990382002-03-27 The following code

Quote> Any help would be appreciated. Stu 0 LVL 10 Overall: Level 10 Delphi 9 Message Expert Comment by:Jacco ID: 68978322002-03-26 He Marcel! 0 LVL 20 Overall: Level 20 Delphi 18 Message Expert Comment by:Madshi I don't get this error message when usnig their database and I don't see any rbuilder.ini file. This will help in tracking down the problem of such an error.

What you should do is use SHGetFolderPath(CSIDL_APPDATA) or similar API to get the path to tbe user's AppData folder, create your own subfolder under it, and then create your .ini file So you can wrap your code in a Try Except block and call RaiseLastOsError to show the error that windows was trying to alert you to. An Array of Challenges #2: Separate a Nested Array more hot questions question feed lang-pascal about us tour help blog chat data legal privacy policy work here advertising info mobile contact Process Stopped.

Don't modify it, just Lines.SaveToFile(x). I would rather imagine that it would end up in the same directory as the EXE, or if not possible, in a virtual store. –Andreas Rejbrand Sep 11 '11 at 10:49 Use %APPDATA% path. I think peter has taken the About code and changed it. –David Heffernan Sep 11 '11 at 10:42 @peter Ah, I forgot there is one difference between TIniFile and

Browse other questions tagged delphi ini or ask your own question. My problem is that I get an "Unable to write INI files" error whenever I try to put data in the username/server area. Read of address 00000000'. What I don't really believe is that TIniFile.Create('myapp.ini') will create a file in the Windows folder (or a virtual-store Windows folder) by default.