04/20(水) 2011
beep音、その2
ひさびさにcpp言語でも。おぼえてないー
filetimecheckloop.cpp
//-------------------------------------- // filetimecheckloop.cpp ver.0.1 // // ファイルtimestamp check loop // // // 2011/04/20 // // #include <windows.h> #include <iostream.h> #include <fstream.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h> const nmax=1000; const int buffmax=2048; char file[nmax]=""; char form[nmax]="%04d/%02d/%02d %02d:%02d:%02d";//書式 char infname[buffmax]=""; char buff[buffmax*5]; char nengappi[nmax]; char* comparetimestamp() { char command0[nmax+nmax]; FILETIME ftime,ltime; SYSTEMTIME sytime; LPSYSTEMTIME stime=&sytime; HANDLE file= CreateFile( infname, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); GetFileTime(file,NULL ,NULL,&ftime); FileTimeToLocalFileTime(&ftime,<ime); FileTimeToSystemTime(<ime,stime); sprintf( nengappi, form, stime->wYear, stime->wMonth, stime->wDay, stime->wHour, stime->wMinute, stime->wSecond ); return nengappi; } mybeep() { int b=880; Beep(b,48); for(int i=1;i*220<4400;i++){ Sleep(24); Beep(b+i*220,24); } } //------------------------------------------- int main(int argc, char** argv) { sprintf(infname,argv[1]); cout<<"file: "<<infname<<endl; char ngp[nmax],old_ngp[nmax]; for( int i=0;;i++){ strcpy(ngp,comparetimestamp()); if(strcmp(ngp,old_ngp)){ cout<<ngp<<endl; mybeep(); strcpy(old_ngp,ngp); } else { // cout<<","; } Sleep(200); } return(0); }
実行例
> filetimecheckloop "c:\Document .. \nantoka"
ここに置きました
コメント
トラックバック - http://rubyist.g.hatena.ne.jp/hatecha/20110420
カレンダー
- PyCrypto:GAE : ローカルだと動かない。 - Windows Live
- Google App Engine Blog: App Engine SDK 1.3.5 Released With New Task Queue, Python Precompilation, and Blob Features
- 線形回帰モデルとか - Standard ML of Yukkuri
- Czajkowski ? Blog Archive ? LoCo Directory Meeting
- The Best Web Development Frameworks
- 2010-06-30 - Webと文字
- Android アプリケーションを強制終了させる ? BPS株式会社 開発ブログ Beyond Perspective Solutions LTD.
- Python cookbook - Google ブックス
- Herald Tribune (HeraldTribune) on Twitter
- Ajaxian ? jQuery.fn.webkitTransform: bananas on the skew-whiff
- rst2pdfの日本語周り設定 - typeof(undefined)
- twoauth/oauth.py at master from techno’s python-twoauth - GitHub
- TRANSLATION LOG トマス・ピンチョン 1973全米図書賞授賞式 を翻訳する
- App Engine: Entity life cycle webhooks in the Datastore admin interface
- win-django.com - 複数のmodelを結合する 1