steam


How to retrieve Steam username using SteamWorks API?


How can I obtain the Steam username of the currently used (logged-in) account in my application using the Steam API (which is up and running).
The Steam id can (for example) be obtained by:
CSteamID id = SteamUser.GetSteamID();
But I cannot find a method to obtain the username.
Account Name
Getting the account name is difficult as there is no API function as far as I know.
But there is a SteamAppData.vdf file in the <SteamInstallPath>/config folder which looks similar to this:
"SteamAppData"
{
"RememberPassword" "<0|1>"
"AutoLoginUser" "<accountName>"
}
You can get the Steam install path with the SteamAPI_GetSteamInstallPath() command defined in steam_api.h.
Then you can read the file and extract the account name out of it.
Player Name
Getting the player name is really easy:
In isteamfriends.h you'll should find this method:
// returns the local players name - guaranteed to not be NULL.
// this is the same name as on the users community profile page
// this is stored in UTF-8 format
// like all the other interface functions that return a char *, it's important that this pointer is not saved
// off; it will eventually be free'd or re-allocated
virtual const char *GetPersonaName() = 0;
So SteamFriends.GetPersonaName() should give you the player name.

Related Links

Steam Top 10 Games by Player Count API Call
item_type in steam community market
Undefined variable: setup and Fatal error: Call to a member function setup()
Get regional applications restrictions using Steam API
Javascript command for clicking a button on Steam
Steam API, All the comments and commented date for a game
Steam : I need to add other option in game menu for resolution
Certain steam games keep crashing my computer
How to get a list of active buy orders for the steam market?
Steam API endpoint to leave groups?
Steam set user status
Steam API: How to get players in current game?
Windows script that pushes button? info? anything?
json API data with all of its content
Verify Game Integrity through Steam API?
API Steam - Account not found

Categories

HOME
swift
nlp
blockchain
visual-studio-2013
json-ld
ruby-on-rails-3
zend-framework2
rfc
lagom
hashicorp-vault
symfony-forms
apache-karaf
quartus
anychart
chocolatey
jogl
frp
i3
google-api-dotnet-client
configure
positioning
jboss5.x
jackson-dataformat-csv
getjson
strophe
modulo
jquery-cycle2
sidr
autocompletetextview
es-shell
elfinder
haskell-pipes
installshield-2012
bayesian-networks
productivity
jrules
jdbi
tableau-server
windows-firewall
ogre3d
cdk
hpcc
cleditor
galleriffic
update-site
mix
webkit2
amf
picking
sun-codemodel
interactive-brokers
git-rebase
asymptote
sonarqube5.3
drf-nested-routers
hornetq
textkit
js-cookie
apigee-baas
on-duplicate-key
harp
pyopengl
twitter-rest-api
bridge
guzzle6
google-plus-one
hiera
word-2013
moai
omnifocus
scala-2.11
grunt-contrib-concat
em
power-law
yahoo-boss-api
code-testing
valence
wss
picat
lumx
ifft
zipalign
circos
sanitization
osx-snow-leopard
robospice
ng-pattern
pep8
qtgui
fluidsynth
template-haskell
autostart
javascriptserializer
xgettext
concurrent-programming
v4l
coff
curljs
cookieless
noir
zend-form-element
hibernate3-maven-plugin
web-statistics
windows-controls
outlook-form
rd

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App