Click here to Skip to main content
15,900,907 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to assign to window HELP id ? Pin
vgrigor14-Oct-03 5:15
vgrigor14-Oct-03 5:15 
Generalread HTML file Pin
Member 62216414-Oct-03 4:58
Member 62216414-Oct-03 4:58 
GeneralRe: read HTML file Pin
valikac14-Oct-03 5:59
valikac14-Oct-03 5:59 
Generalproblems when reading saving/loading a registry key in WinXP Pin
wfettich14-Oct-03 4:38
wfettich14-Oct-03 4:38 
Question(DirectShow) AVI player using CFrameWnd class ??? Pin
Saurabh_Delhi14-Oct-03 4:26
Saurabh_Delhi14-Oct-03 4:26 
Generalneed some codeproject c++ expertise... Pin
joshfl14-Oct-03 4:02
joshfl14-Oct-03 4:02 
GeneralRe: need some codeproject c++ expertise... Pin
jhwurmbach14-Oct-03 4:56
jhwurmbach14-Oct-03 4:56 
GeneralRe: need some codeproject c++ expertise... Pin
joshfl14-Oct-03 6:03
joshfl14-Oct-03 6:03 
I'm using Sleep() to make it wait. I used the term '30 seconds' loosely before, as you can see in my code posted below I dont quite wait that long even Smile | :)

It doesnt still appear in task manager, it just disappears from everywhere nice and sneaky and strange like! Its not a service.

I know I could build data by coding some logging / RT- data analysis into the program , and then use process of elimination to narraw the problem down between the program or o/s / environment conditions, which I guess seems to be one of my few remaining options so I may bite the bullet and do it this way, i was just hoping i was doing it the hard way or something Smile | :)


#include "stdafx.h"
#include "FileInfo.h"
#include <iostream.h>
#include <fstream.h>

int __cdecl main(int argc, char* argv[])
{

CString s;
char c1[6000]; // Text
char c2[255]; // Storage
char cSpoolFile[300];
char cOutFile[300];
char cOutFileTwo[300];
char cIgnoreList[21000];
char testhold[21000];
char c4[]="blah\0"; // key
int len; //
int result;
int numread;
int sorted = 0;
FILE *input;

fstream outfile;

// read in configuration
ifstream inStream("config.txt");
inStream.getline(cSpoolFile, 300, '\n');
inStream.getline(cOutFile, 300, '\n');
inStream.getline(cOutFileTwo, 300, '\n');
inStream.close();

// read ignore
ifstream inStreamtwo("ignore.txt");
while (!inStreamtwo.eof()) {
inStreamtwo.getline(testhold, 21000, '\n');
s += testhold;
if (!inStreamtwo.eof()) { s += "|"; }
}
inStreamtwo.close();

// null terminate
s += "\0";

// make string to char for var passed into .dll
strcpy(cIgnoreList, s);

// notification...
printf ("Starting Loop.....\n\n");

// loop forever here
while (1) {

// Open directory for read
CFileInfoArray fia;
fia.AddDir(
cSpoolFile, // Directory
"*.*", // Filemask (all files)
FALSE, // Recurse subdirs
CFileInfoArray::AP_SORTBYNAME | CFileInfoArray::AP_SORTASCENDING, // Sort by name and ascending
FALSE // Do not add array entries for directories (only for files)
);

/// here will start the directory iteration
for (int ji=0;ji<fia.GetSize();ji++) {

// read file
if ( (input = fopen( fia[ji].GetFilePath(), "r" ) ) == NULL )
{
//printf( "Could not open file.......%s\n", fia[ji].GetFilePath() );
return 0;
}
// read input , set numread to amount read
numread = fread( c1, sizeof( char ), sizeof(c1), input );
c1[++numread] = '\0'; // null terminate
fclose( input );

// Call the external function with some parameters
result = EXTERNALFUNCTION( *c1, *c2, len, *cIgnoreList, *c4 );

sorted++; // increment the proccessed files count

// act on type returned
switch( result )
{
case PARAM_ONE:
// Open the output file
outfile.open(cOutFile, ios::app);
outfile << c2 << endl;
outfile.close();
break;
case PARAM_TWO:
outfile.open(cOutFileTwo, ios::app);
outfile << c2 << endl;
outfile.close();
break;
default:;
//printf( "Unknown return value\n" );
}

// clear status screen
printf("%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8);
printf(" ");
printf("%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8);

// refresh status
printf("%d", sorted);

// remove file
unlink (fia[ji].GetFilePath());

}

// wait before loop
Sleep(1000);

}
return 0;

}




todo....
:: insert inpirational text here ::
GeneralRe: need some codeproject c++ expertise... Pin
igor196014-Oct-03 8:27
igor196014-Oct-03 8:27 
GeneralRe: need some codeproject c++ expertise... Pin
joshfl14-Oct-03 10:27
joshfl14-Oct-03 10:27 
GeneralRe: need some codeproject c++ expertise... Pin
David Crow14-Oct-03 5:43
David Crow14-Oct-03 5:43 
GeneralRe: need some codeproject c++ expertise... Pin
joshfl14-Oct-03 6:10
joshfl14-Oct-03 6:10 
GeneralRe: need some codeproject c++ expertise... Pin
Abin14-Oct-03 14:38
Abin14-Oct-03 14:38 
GeneralRe: need some codeproject c++ expertise... Pin
joshfl15-Oct-03 8:13
joshfl15-Oct-03 8:13 
GeneralRe: need some codeproject c++ expertise... Pin
PremL14-Oct-03 5:51
PremL14-Oct-03 5:51 
GeneralRe: need some codeproject c++ expertise... Pin
joshfl14-Oct-03 6:12
joshfl14-Oct-03 6:12 
GeneralRe: need some codeproject c++ expertise... Pin
joshfl14-Oct-03 10:23
joshfl14-Oct-03 10:23 
GeneralRe: need some codeproject c++ expertise... Pin
Xiangyang Liu 刘向阳14-Oct-03 7:09
Xiangyang Liu 刘向阳14-Oct-03 7:09 
QuestionHow to improve bitmap drawing quality? Pin
Member 47752414-Oct-03 3:43
Member 47752414-Oct-03 3:43 
GeneralCreating an unknown number of checkboxes Pin
b_girl14-Oct-03 3:42
b_girl14-Oct-03 3:42 
GeneralRe: Creating an unknown number of checkboxes Pin
b_girl14-Oct-03 3:48
b_girl14-Oct-03 3:48 
GeneralRe: Creating an unknown number of checkboxes Pin
Terry O'Nolley14-Oct-03 5:21
Terry O'Nolley14-Oct-03 5:21 
GeneralRe: Creating an unknown number of checkboxes Pin
David Crow14-Oct-03 6:55
David Crow14-Oct-03 6:55 
Questionhow to trigger some action by jus selecting the text? Pin
ramya8314-Oct-03 1:44
ramya8314-Oct-03 1:44 
AnswerRe: how to trigger some action by jus selecting the text? Pin
David Crow14-Oct-03 3:08
David Crow14-Oct-03 3:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.