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: How retrieve game scheme data?
SteamID64 minimum and maximum length
IEconItems_730 api no longer working
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

Categories

HOME
ajax
project-management
freepascal
raspbian
boost-thread
smartphone
reportportal
phonegap-cli
console
dataframe
wysiwyg
local
pdo
zope
ng-show
jogl
ip-camera
flexboxgrid
statusbar
sensu
autolayout
cocoa-touch
explode
csh
iis-10
jflex
compare-and-swap
fetch-api
forum
xor
read-write
edb
fractals
nsurlconnection
phpspreadsheet
gettext
von-neumann
viewstate
nodeclipse
coreclr
parse-android-sdk
fltk
ntfs-mft
wcf-security
intellij-idea-2016
exiftool
nsexception
resuming-training
dojox.grid.datagrid
windows-firewall
jenkins-jira-trigger
webdatagrid
shutdown
slot
forerunnerdb
instruction-set
tofixed
fontconfig
python-hypothesis
pdfkit
libtiff.net
nsfetchedresultscontrolle
coremidi
android-navigationview
pdflib
nofollow
pagekit
inotifypropertychanged
emokit
mongo-c-driver
handlebars.java
web-essentials
data-import
enyo
apigee-baas
anti-patterns
mptcp
connection-reset
stream-framework
castle-windsor-3
manjaro
ffprobe
type-mismatch
viper-architecture
uptodate
chaining
moai
gmaps4rails
tcpreplay
mser
collabnet
suffix-array
log4cplus
method-overriding
facebook-wall
boost-test
help-viewer
visual-c++-2010-express
hamsterdb
opendata
real-time-updates
nservicebus4
va-list
threadx
adomd.net
client-library
fieldset
icsharpcode
unions
parameterization
newsstand-kit
goliath
rubycas
ets
.app
clause
yajl
delegatecommand
winverifytrust
grooveshark
visual-studio-2010-beta-2
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