Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c - Win32 dispatch program and redirect stdout to file buffer problem? -


on wi32 trying start executable redirects filename (current date) e.g. same as:

someexecutable.exe > 20101220000000.txt

when windows cmd.exe works fine. when doing program shown below system seems ot either drop redirect if creates file and/or seems buffer large amount of data before flushing disk. can't change executable being run. program beeing executed writes stdout, remember can't change @ all. (the simplest way woud stdout = filehandle; sadly impossible me right now!)

(not required: program waits system() not required simplest way of detaching program being run via system() )

#include <stdio.h> #include <stdlib.h> #include <time.h>  int main(int argc, char *argv[]) {   char   execstr[512];   char   s[30];   size_t i;   struct tm tim;   time_t now;    = time(null);   tim = *(localtime(&now));     = strftime(s,30,"%y%m%d%h%m",&tim);    sprintf(execstr,"someexecutable.exe > %s.txt",s);   printf("executing: \"%s\"\n",execstr);    system(execstr);   exit(0);   return 0; } 

i don't see reason not work, if case you, 1 of alternative solution use popen , read pipe writing in desired file. here sample code printing on screen. can write file instead of screen/console per requirement.

#include <stdio.h> #include <stdlib.h> #include <time.h>  int main(int argc, char *argv[]) {   char   execstr[512];   char   s[30];   size_t i;   struct tm tim;   time_t now;   char   buf[128];   file   *pipe;    = time(null);   tim = *(localtime(&now));     = strftime(s,30,"%y%m%d%h%m",&tim);  #if 0   sprintf(execstr,"a.exe > %s.txt",s);   printf("executing: \"%s\"\n",execstr); #endif /* #if 0 */     if( (pipe = _popen("a.exe", "rt")) == null )       exit( 1 );     while(!feof(pipe))    {       if (fgets(buf, 128, pipe) != null )          printf(buf);   /* write required file here */    }     _pclose(pipe);    return 0; } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -