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 market API returns null
How to get the float value of CS:GO market items?
Using steam web api to access how many times players are reported for hacking
Steam game positive/negative recommendations
Alternatives to the CS:GO API?
Get list of players from server
Node-steam-trade, how to get items names?
Is it possible to create/join a lobby with 4 people, not on friends list, programmatically? [Steam + CSGO]
Steam Web API GetPlayerItems
How to find the path to Steam's sourcemods folder?
Using the SteamWebAPI to send a tradeoffer?
Getting CS:GO player stats
Steam User data
Steam API - Game Controller Support
Steam Web Api: CS:GO Getting Skin name of items
SteamWebAPI IDOTA2Match_570 getScheduledLeagueGames

Categories

HOME
payment-gateway
oauth
google-contacts
laravel-5.3
decorator
codeeffects
rocketmq
iis-7.5
nodemailer
goutte
vuex
google-classroom
jboss-eap-7
cartodb
outlook-web-addins
lagom
cosmicmind
pdo
python-unicode
flexlm
linq-to-sql
epicor
fop
onsen-ui
logarithm
auditing
opencart2.3
ui5
excel-2013
upnp
frp
weinre
modulo
geomesa
rhel.net
datalog
constants
jdbi
nsjsonserialization
windows-firewall
amazon-machine-learning
rhel6
decompress
openh264
crystal-reports-8.5
iphone-developer-program
selenium-firefoxdriver
rsqlite
nsfetchedresultscontrolle
ebtables
libreadline
packagemaker
excon
scalar
jackson-databind
contour
multilingual-app-toolkit
group-concat
fill
magento-1.4
spservices
sonarqube5.3
geodjango
application-loader
vips
fabric-twitter
mogrify
on-duplicate-key
cpu-cores
code-first-migrations
consensus
pisa
java-collections-api
factors
hamsterdb
modeshape
surveyor-gem
cgimageref
qt4.6
dynamic-data
linkedhashset
scrollto
pstree
cosm
shim
z-machine
jpf
ubuntu-11.04
nsindexpath
easygui
associative
phpcrawl
act
dirty-data
visual-studio-dbpro
document-library

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