This snippet will write a text file.
#include <fstream.h> int main() { ofstream outfile("example.txt"); if (outfile.is_open()) { outfile << "This is a line.n"; outfile << "This is another line.n"; outfile.close(); } return 0; }
This snippet will write a text file.
#include <fstream.h> int main() { ofstream outfile("example.txt"); if (outfile.is_open()) { outfile << "This is a line.n"; outfile << "This is another line.n"; outfile.close(); } return 0; }
To parse command line arguments passed to a script without using a module, parse @ARGV with the following:
foreach my $arg (@ARGV) { $a = 1, next if $arg eq '-a'; $b = 1, next if $arg eq '-b'; $c = 1, next if $arg eq '-c'; }
Note: This is good only for boolean (on/off) command line switches.
ptkdb is a graphical Perl debugger. To use it when debugging command line scripts is very straight forward. Just type in the command line:
perl -d:ptkdb script.pl
and you’re good to go.
However, using it to debug CGIs needs some tweaking to your CGI source. Replace the usual
#!/usr/bin/perl
line at the top of the CGI script with this one:
#!/usr/bin/perl -d:ptkdb BEGIN {$ENV{DISPLAY} = "$ENV{REMOTE_ADDR}:0.0";}
Go to your browser and invoke your CGI and a debugger window should pop up.
Starting with iTunes 4.5, Apple implemented those little grey arrows next to the song title, artist, and album, which will take you to the corresponding match in the iTunes Music Store. To change the behavior of these arrows so that instead of going to the store, it will take you to your library instead, you can do either one of two ways:
defaults write com.apple.iTunes invertStoreLinks -bool YES
Make sure iTunes is not running when you execute this command.
To enable Safari Debug menu from the command line:
% defaults write com.apple.Safari IncludeDebugMenu 1
Make sure Safari is not running when you run this command.