c 列舉檔名
view plain
C++:
#include <stdio.h>
#include <io.h>
#include <time.h>
void main(void)
{
struct _finddata_t c_file;
long hFile;
if( (hFile = _findfirst( "*.* ", &c_file )) == -1L)
printf( "No *.c files in current directory!n " );
else
{
[...]
c 列舉檔名
view plain
C++:
#include <stdio.h>
#include <io.h>
#include <time.h>
void main(void)
{
struct _finddata_t c_file;
long hFile;
if( (hFile = _findfirst( "*.* ", &c_file )) == -1L)
printf( "No *.c files in current directory!n " );
else
{
[...]
Spying a file system
FindFirstChangeNotification & Shell_NotifyIcon together... again
此 script 的作用:批次移除 wav 檔的檔頭,產生 pcm 檔
使用方法
BatchRipWavHdr.pl WavLst.txt
WavLst.txt 為來源wav檔的路徑列表,使用前需先設定產生的 pcm 檔要放在哪個目錄「$dest_prefix」,若要依照來源目錄層次第 n 層來存放,可設定「$sublayer」
view plain
PERL:
#!/usr/bin/perl -w
#
#動態的為Wav檔求算出其Header的size
#
use File::Path;
if(scalar @ARGV!=1)
{
print "Usage: BatchRipWavHdr.pl WavLst.txt" ;
exit;
}
$dest_prefix='C:\Tel100_PCM';
#$dest_prefix='H:\Spelled_Spoken\BatchRipWavHeader';
$sublayer='1';
#$hdr='48'; #bytes
$number=0;
while(<>)
{
#Y:\cdrom\spelled_spoken\speech\alphabet\23\call2316.alphabet.wav
chomp;
$source=$_;
$hdr=44;#&CheckHeaderByte($source);
@dir=split /\\/,$_;
@dir=@dir[$sublayer..$#dir];
$pcm=pop @dir;
$pcm=~s/wav$/pcm/i;
$dir=join '\\',@dir;
$dir.='\\';
$dir=$dest_prefix.'\\'.$dir if($dest_prefix ne '');
eval { mkpath($dir) };
if ($@) {
print "Couldn't create $dir: $@";
}
$dest=$dir.$pcm;
open SOURCE,"$source" or die "$!";
open DEST,">$dest" or die "$!";
seek SOURCE,$hdr,0;
while(sysread SOURCE,$buf,4096)
{
syswrite DEST,$buf,4096;
}
print ++$number,"\r";
}
sub CheckHeaderByte
{
my ($wav)=@_;
my($out,$buf,$data,$hdr);
open WAV,"$wav" or die "WAV:$!";
binmode [...]
Set $| to a non-zero value. grep the man page for "autoflush" for further information.
view plain
PERL:
$oldhandle = select(FILEHANDLE);
$| = 1;
select($oldhandle);
轉貼自 Sysoft 時空論壇,順便介紹msdn沒有說明的函數 AfxExtractSubString
view plain
C++:
// Open the text file we want
CFile cfFile ("C:\TextFile.txt", CFile::modeNoTruncate | CFile::modeRead);
CArchive ar (&cfFile, CArchive::load); // Load its contents into a CArchive
// Initialise the variable which holds each line's contents
CString strLine = "";
if(!ar.ReadString(strLine))
// Read the first line of the CArchive into the variable
return; // Failed, so quit out
do // Repeat while there [...]