I am looking to create a little setup program for naming files. In it there are separate sections where a user could specify a file name separator, you know a dash, underscore or a space. So, they want a space, I write a space to the ini file. I open the ini file and the space is there. No problem, however when you read the ini file it disregards it.
Is there some sort of setting that makes it read a space? Yes I could do a work around but it doesn't make sense to have to. You know if you really want a space put in to "##" etc in the setup. And then write the ## and when it is read convert it back to a space. Or I see the space in the setup, I write the ## and then translate it into a space.
Personally I would go with an underscore or a dash, but, you can't always get what you want and it this case I have to have a space.
Spaces in ini file
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Spaces in ini file
INI files can have spaces. Maybe I'm missing something but spaces are no problem for me:
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Spaces in ini file
That is not what I am talking about I am talking about this:
SEP1=
After this there is a space in the ini file. You can't see it, as it is a space. It is there when you open the ini file and put your cursor there so it is being written to. However, it is not being read. It's easy enough to have a # and then replace that when it is read with a space but it would be nice to skip that if it is a option.
SEP1=
After this there is a space in the ini file. You can't see it, as it is a space. It is there when you open the ini file and put your cursor there so it is being written to. However, it is not being read. It's easy enough to have a # and then replace that when it is read with a space but it would be nice to skip that if it is a option.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Spaces in ini file
It works if you use quotes:
[settings]
step1=" "
Use quotes when you write out and then those spaces between won't be ignored:
https://en.wikipedia.org/wiki/INI_file#Quoted_values
[settings]
step1=" "
Use quotes when you write out and then those spaces between won't be ignored:
https://en.wikipedia.org/wiki/INI_file#Quoted_values
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Spaces in ini file
Thanks, I put in use a # sign and then when it was read I replaced it with a space. The issue was that eventually I will press the button to remove trailing spaces and then it would be broken. Thanks for the proper fix.
Regards
Regards
- CyberCitizen
- Automation Wizard
- Posts: 724
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia