# How to use PrivateProfileString()

**URL:** https://discourse.processing.org/t/how-to-use-privateprofilestring/17631
**Category:** Libraries
**Created:** [February 8, 2020, 3:23am UTC](https://discourse.processing.org/t/how-to-use-privateprofilestring/17631 "2020-02-08T03:23:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![spflanze](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@spflanze](https://discourse.processing.org/u/spflanze)
#### Post date: [February 8, 2020, 3:23am UTC](https://discourse.processing.org/t/how-to-use-privateprofilestring/17631/1 "2020-02-08T03:23:20Z")

</div>

I am attempting to follow the example at:

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/4954/how-to-read-ini-files-in-processing)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.

  
to store user settings between sketch invocations. I am using the Eclipse IDE to develop it.

In this code snippet:

```auto
        /** default starting directory where browsing for an output file to write to will start */
	public File fStartingDataFilePath = new File( "C:\\Hotfix\\*.csv" );

	/** ini file section for files */
	public String sIniSectFile = "Files";
	
	/** ini file key for default ouput data file path */
	public String iIniKeyDataFilePath = "DataFilePath";

...

        System.PrivateProfileString( sIniFile, sIniSectFile, iIniKeyDataFilePath) = fStartingDataFilePath.getAbsolutePath();

```

I get two errors on the last line above:

```auto
Multiple markers at this line
	- The method PrivateProfileString(String, String, String) is undefined for the type 
	 System
	- The left-hand side of an assignment must be a variable

```

The second error is easy for me to understand because I have never before seen a function, or method, call set equal to something. Yet that is what that example does.

The first error means my version of the System class does not have the PrivateProfileString method. What do I need to import to have this?

What is the right way to do this?

---

<div class="post-metadata">

### Author: ![bucherjo](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@bucherjo](https://discourse.processing.org/u/bucherjo)
#### Post date: [February 8, 2020, 8:29am UTC](https://discourse.processing.org/t/how-to-use-privateprofilestring/17631/2 "2020-02-08T08:29:14Z")

</div>

Hello spflanze  
Could you show us the code in the example that you used?

Otherwise you could try it with a java library for editing .ini files. One such library would be:  
[http://ini4j.sourceforge.net/](http://ini4j.sourceforge.net/)

---

<div class="post-metadata">

### Author: ![spflanze](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@spflanze](https://discourse.processing.org/u/spflanze)
#### Post date: [February 10, 2020, 10:38pm UTC](https://discourse.processing.org/t/how-to-use-privateprofilestring/17631/3 "2020-02-10T22:38:02Z")

</div>

Thanks for this ini4j. I have decided to use it. The download gave me two libraries:

```auto
ini4j-0.5.4.jar
ini4j-0.5.4-jdk14.jar

```

I do not know which to use. Under what circumstance is each one to be used?

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [February 16, 2020, 5:08pm UTC](https://discourse.processing.org/t/how-to-use-privateprofilestring/17631/4 "2020-02-16T17:08:34Z")

</div>

@Chrisir is the one who posted that code snippet you linked from 2014 – but I believe that is VBA (Visual Basic for Applications) code, not Processing!
