Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. function that doesn't care about the type in the paramater??

function that doesn't care about the type in the paramater??

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johnstonsk
    wrote on last edited by
    #1

    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<log == true)){
    if(i == 0){
    fout<<data[i]<

    Thnaks for the help,
    Steven

    B 1 Reply Last reply
    0
    • J johnstonsk

      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<log == true)){
      if(i == 0){
      fout<<data[i]<

      Thnaks for the help,
      Steven

      B Offline
      B Offline
      Brian Delahunty
      wrote on last edited by
      #2

      What is the actual problem your getting? Regards, Brian Dela :-)

      J 1 Reply Last reply
      0
      • B Brian Delahunty

        What is the actual problem your getting? Regards, Brian Dela :-)

        J Offline
        J Offline
        johnstonsk
        wrote on last edited by
        #3

        It's saying that the type of void is unknown or zero. thanks steven

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups