Linux Wiki


Back to Msoft Website docs

Lister le contenu d'un dossier en C++

9.16.2006

Pour parcourir un dossier et lister les fichiers qui s'y trouvent en C++:
scandir, alphasort, versionsort - Sélectionner des éléments d'un répertoire.
opendir - Ouvrir un répertoire.
closedir - Fermer un repertoire.
readdir - Consulter un répertoire.
rewinddir - Réinitialiser un flux répertoire.
seekdir - Positionner le pointeur de flux répertoire pour le prochain
appel readdir().

Pour toutes ces fonctions, il suffit de taper: man NomDeFonction pour un
exemple.

Admin settings GDM

9.03.2006

Several to disable options in GDM and gnome:

You need to change gdm's config to remove the menu options.
Open /etc/X11/gdm/gdm.conf in a text editor and find the [greeter]
section. Make sure there is a line like this:

[greeter]
...
SystemMenu=false

This removes the shutdown/reboot options from the log-in screen and the
log-out dialog. Alternatively run gdmconfig and provide the root
password, then uncheck the 'Show action menu' option on the security
tab.

To prevent users opening a terminal and running poweroff or reboot,
delete or move these files:

/etc/security/console.apps/poweroff
/etc/security/console.apps/reboot

If your machines use ACPI, you will also need to disable ACPI-driven
shutdowns from the power button.

On more to go now, to prevent someone switching to a virtual console and
hitting ctrl-alt-del, we need to edit inittab. Find the line that looks
like this:

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

And change it to read:

# Disallow CTRL-ALT-DELETE
ca::ctrlaltdel:/bin/echo "ctrl-alt-delete has been disabled"

(You can use /bin/true, or /usr/bin/logger etc. here instead if you wish
- just watch out if someone tries ctrl-alt-del before /usr is mounted :)

Chaines de caractères en C++

Chaines de caractères en C++:

http://c.developpez.com/faq/cpp/?page=strings

Firefox Protocol Handlers


Firefox Protocol Handlers
<http://blog.ryaneby.com/archives/firefox-protocol-handlers/>

November 27th, 2005 in General
<http://blog.ryaneby.com/archives/category/general/> .

This is a tip I found back when I was having various problems with
external applications not working with Firefox the way I wanted. It also
helps if you want to create your own protocols for testing/development, etc.

By protocol what I mean is the URL prefix such as aim:// mailto:// etc.
Usually when you install a program that uses it’s own protocol prefix it
will update your browser with the correct information. On linux and OSX
though I’ve had mixed results and sometimes I want to send the
information to other programs such as mplayer or VLC even on Windows. My
original problem was with the Last.fm service whose radio player uses
the lastfm:// protocol.

If you don’t already know you can type about:config into the address bar
in Firefox and get advanced settings. This allows you to highly tweak
the browser if you wish. It also allows you to add custom settings which
is what we need to do. The general layout is:

network.protocol-handler.external.protocol = boolean (true or false)
network.protocol-handler.app.protocol = /path/to/program

I’ve found that there is no need to do the external boolean in my
testing just the app one. So to add the lastfm:// protocol you would go
to about:config and then right-click somewhere and choose new > string.
You would then enter the following information:

Preference Name: network.protocol-handler.app.lastfm
Value: /path/to/lasfm/player (/home/ebyryan/Downloads/lastfm/player in
my case)

For windows it would likely be the “C:\dir\to\file” structure while OSX
would have similar syntax to above (try terminal). You will likely need
to restart firefox to notice the change. I’ve also used this to handle
iTunes (itmss) protocols. If your in an internal setting where you
control people’s computers you could use this to create custom protocols
for your intranet that launch specific software on the users computers
when they click on items. Not sure how useful that is though.

(source: http://blog.ryaneby.com/archives/firefox-protocol-handlers/)