Click here to Skip to main content
15,922,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalmy exe's small icon Pin
Marissa18230-Jul-03 11:02
Marissa18230-Jul-03 11:02 
GeneralRe: my exe's small icon Pin
Beer2630-Jul-03 11:49
Beer2630-Jul-03 11:49 
GeneralShut Down the pc Pin
Anonymous30-Jul-03 10:48
Anonymous30-Jul-03 10:48 
GeneralRe: Shut Down the pc Pin
User 665830-Jul-03 10:51
User 665830-Jul-03 10:51 
GeneralRe: Shut Down the pc Pin
Anonymous30-Jul-03 11:30
Anonymous30-Jul-03 11:30 
GeneralRe: Shut Down the pc Pin
John M. Drescher30-Jul-03 11:47
John M. Drescher30-Jul-03 11:47 
GeneralNon MDI /SDI Pin
act_x30-Jul-03 10:20
act_x30-Jul-03 10:20 
QuestionHow to make a function that you can pass any type of array to?? Pin
johnstonsk30-Jul-03 10:02
johnstonsk30-Jul-03 10:02 
AnswerRe: How to make a function that you can pass any type of array to?? Pin
Dean Goodman30-Jul-03 10:20
Dean Goodman30-Jul-03 10:20 
GeneralRe: How to make a function that you can pass any type of array to?? Pin
johnstonsk30-Jul-03 10:33
johnstonsk30-Jul-03 10:33 
GeneralRe: How to make a function that you can pass any type of array to?? Pin
Ian Darling30-Jul-03 11:19
Ian Darling30-Jul-03 11:19 
GeneralRe: How to make a function that you can pass any type of array to?? Pin
Dean Goodman30-Jul-03 11:42
Dean Goodman30-Jul-03 11:42 
AnswerRe: How to make a function that you can pass any type of array to?? Pin
Neville Franks30-Jul-03 10:33
Neville Franks30-Jul-03 10:33 
AnswerRe: How to make a function that you can pass any type of array to?? Pin
Ian Darling30-Jul-03 11:12
Ian Darling30-Jul-03 11:12 
GeneralRe: How to make a function that you can pass any type of array to?? Pin
Jörgen Sigvardsson30-Jul-03 11:55
Jörgen Sigvardsson30-Jul-03 11:55 
GeneralRe: How to make a function that you can pass any type of array to?? Pin
Ian Darling30-Jul-03 12:58
Ian Darling30-Jul-03 12:58 
AnswerRe: How to make a function that you can pass any type of array to?? Pin
John M. Drescher30-Jul-03 11:53
John M. Drescher30-Jul-03 11:53 
GeneralShellExecute and highlighting Pin
heju30-Jul-03 9:57
heju30-Jul-03 9:57 
GeneralCMainFrame Pin
act_x30-Jul-03 9:35
act_x30-Jul-03 9:35 
GeneralToolBar Pin
Anonymous30-Jul-03 8:36
Anonymous30-Jul-03 8:36 
GeneralRe: ToolBar Pin
Frank K31-Jul-03 0:50
Frank K31-Jul-03 0:50 
GeneralDialog events when in a View Pin
Anonymous30-Jul-03 8:31
Anonymous30-Jul-03 8:31 
GeneralRe: Dialog events when in a View Pin
Bob Stanneveld30-Jul-03 9:19
Bob Stanneveld30-Jul-03 9:19 
Questionfunction that doesn't care about the type in the paramater?? Pin
johnstonsk30-Jul-03 8:23
johnstonsk30-Jul-03 8:23 
Sorry the subject was hard to summerize.

I have created a function that I thought was type independent, meaning that it didn't matter what type of an array was passed to the function. It would just write the data with a comma seperation.

I have 2 structure in a class called RFMAccess:

struct TSimHeader
    {
	char   Name[47][21];
	char   Unit[47][21];
	double Min[47];
	double Max[47];
	int SignalCount;
	int SimStatus;

    }static TSimHeader_arr[10];


    struct TSimSignal
    {
       	double Value[47];
	double TimeStamp;

    }static TSimSignal_arr[10];


The data in these structures gets updated 2x a second.
I also want to write the data to a file 2x a second so, I created a function that I thought would do this without having to declare the array type. I want to be able to use this later in other projects.

Here is my function.
I am doing something incorrect here, but just not sure what it is.

ofstream fout ("test.txt");
bool firstTime = true;
int passes = 1;




void LogData::writeData(void *data){	
    int count;
    if(firstTime){
        fout<<"flight_data,";
        for(int i=0; i<RFMAccess::TSimHeader_arr[0].SignalCount; i++){
           if(i == 0){
            fout<<data[i]<<endl;
            passes++;
            if(passes == 2)
                writeData(RFMAccess::TSimHeader_arr[0].Unit);
            else if(passes == 3)
                writeData(RFMAccess::TSimHeader_arr[0].Min);
            else if(passes == 4)
                writeData(RFMAccess::TSimHeader_arr[0].Max);
            else if(passes == 5){
                firstTime = false;
                writeData(RFMAccess::TSimSignal_arr[0].Value);
            }
        }
        else
            fout<<data[i]<<",";
        }
    }
    if(!firstTime &&(flight_data->log  == true)){
         if(i == 0){
            fout<<data[i]<<endl;
            writeData(RFMAccess::TSimSignal_arr[0].Value);
         }
         else
            fout<<data[i]<<",";
    }
}


Thnaks for the help,
Steven
AnswerRe: function that doesn't care about the type in the paramater?? Pin
Brian Delahunty30-Jul-03 9:37
Brian Delahunty30-Jul-03 9:37 

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.