Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8822089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:00:57+00:00 2026-06-14T06:00:57+00:00

first of all I’m a hardware programmer (HDL, uC programming) and was asked by

  • 0

first of all I’m a hardware programmer (HDL, uC programming) and was asked by my boss a couple of days ago to create an Interface in visual C++ to control a uC. I never used visual C++ before and my software programming skills are intermediate at best. However, I only have till Tuesday to get the interface to work, therefore I had to look for examples and do the same, due to the time frame I have. So please excuse me if I ask any obvious and stupid questions.

In my code, I have to move values stored in an array to a CSV file. So I have to separate my values using commas…
However, in order to create a CSV file, I have to use fstream (as far as I understood from what I’ve read so far).
Whenever I use

#include <fstream>

I get a huge amount of errors such as:

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(244): error C3083: 'vc_attributes': the symbol to the left of a '::' must be a type
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(244): error C2039: 'YesNoMaybe' : is not a member of '`global namespace''

Here is the rest of my code related to fstream:

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO::Ports;
#include <iostream>
#include <fstream>

      std::ofstream myfile;
            myfile.open("Data.txt");
            //find available ports
            private: void findports(void){
                         array<Object^>^ objectArray = SerialPort::GetPortNames();
                         this->comboBox4->Items->AddRange( objectArray );
                         array<String ^> ^ h = gcnew array<String ^>(24);
                         for(int i=0; i<=23; i++){
                             h[i]= String::Concat(i.ToString());
                         }
                         this->comboBox1->Items->AddRange( h );
                          array<String ^> ^ m = gcnew array<String ^>(60);
                         for(int i=0; i<=59; i++){
                             m[i]= String::Concat(i.ToString());
                         }
                         this->comboBox3->Items->AddRange( m );
                          array<String ^> ^ s = gcnew array<String ^>(24);
                         for(int i=0; i<=23; i++){
                             s[i]= String::Concat(i.ToString());
                         }
                         this->comboBox5->Items->AddRange( s );
                          array<String ^> ^ d = gcnew array<String ^>(366);
                         for(int i=0; i<=365; i++){
                             d[i]= String::Concat(i.ToString());
                         }
                         this->comboBox2->Items->AddRange( d);
                     }








        private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
                 }
        private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
                 }
    private: System::Void label4_Click(System::Object^  sender, System::EventArgs^  e) {
             }
    private: System::Void label5_Click(System::Object^  sender, System::EventArgs^  e) {
             }
    private: System::Void label6_Click(System::Object^  sender, System::EventArgs^  e) {
             }
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

                 if((this->comboBox4->Text == String::Empty)||(this->textBox1->Text == String::Empty)||(this->textBox2->Text == String::Empty)){
                     this->textBox1->Text="missing port settings";
                     this->textBox2->Text="missing port settings";
                 }
                 else{ // start assigning
                     try{ // first make sure port isn't busy/open
                         if(!this->serialPort1->IsOpen){
                             // select the port whose name is in comboBox4 (select port)
                             this->serialPort1->PortName=this->comboBox4->Text;
                             //open the port
                             this->serialPort1->Open();


                             // sending
                             String^ name_ = this->serialPort1->PortName;
                             String^ sampling_period_ = this->comboBox5->Text;

                             String^ days_ = this->comboBox2->Text;

                             String^ hours_ = this->comboBox3->Text;

                             String^ minutes_ = this->comboBox1->Text;

                             String^ start_ = this->textBox1->Text;

                             String^ end_ = this->textBox2->Text;

                             //send data to setup timer on the microcontroller
                             this->serialPort1->WriteLine(sampling_period_);
                             this->serialPort1->WriteLine(days_);
                             this->serialPort1->WriteLine(hours_);
                             this->serialPort1->WriteLine(minutes_);
                             // send slave addresses
                             this->serialPort1->WriteLine(start_);
                             this->serialPort1->WriteLine(end_);


                             // receiving
                             int rec[100][8];
                             for (int i=0;i<sizeof(rec[0]);i++){
                                 for (int j=0;j<sizeof(rec);j++){
                                     rec[i][j]=int::Parse(this->serialPort1->ReadLine());
                                 }
                             }
                             myfile<<"ADC1"<<","<<"ADC2"<<","<<"ADC3"<<","<<"ADC4"<<","<<"ADC5"<<","<<"ADC6"<<","<<"ADC7"<<","<<"ADC8"<<endl;
                             for (int i=0;i<sizeof(rec[0]);i++){
                                 for (int j=0;j<sizeof(rec);j++){
                                     myfile<<rec[i][j]<<",";
                                 }
                                 myfile<<endl;
                             }



                         }
                         else{
                             this->textBox1->Text="Warning: port is busy or isn't open";
                             this->textBox2->Text="Warning: port is busy or isn't open";
                         }
                     }
                        catch(UnauthorizedAccessException^){
                            this->textBox1->Text="Unauthorized access";
                            this->textBox2->Text="Unauthorized access";
                        }
                     }

             }
    private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
             }
    private: System::Void label7_Click(System::Object^  sender, System::EventArgs^  e) {
             }
    private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {

             }
    private: System::Void label8_Click(System::Object^  sender, System::EventArgs^  e) {
             }
    };
    }

I hope to get some help or at least any useful information in here.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:00:58+00:00Added an answer on June 14, 2026 at 6:00 am
    #include <fstream>
    std::ofstream myfile;
        myfile.open("Data.txt");
    

    That last line is a statement, which can only occur inside a function, not at namespace scope (i.e. outside any function body) as you’ve written it.

    44): error C3083: 'vc_attributes': the symbol to the left of a '::' must be a type
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(244): error C2039: 'YesNoMaybe' : is not a member of '`global namespace''
    

    This error cannot possibly come from the code you showed, which doesn’t mention vc_attribtues or YesNoMaybe. You’ll get better answers if you simplify your code to the minimum necessary to show the problem, and post the error that matches the code.

    I’m not sure what you expect to get from sizeof(rec) but it’s probably not what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all a statement: I'm a newbie when it comes to programming for
First of all this is all just concept, I have no actual programming done
first of all, I'm starting yesterday on Android programming. I'm making a String, and
First of all, this isn't for a keylogger, it's for an input in a
first of all some details: I configured security as below in web.xml view plaincopy
First of all, I'm quite new to the Android and JAVA world (coming from
first of all i would like to say i know its probably an easy
First of all there is probably a question like this already but i couldn't
First of all, apologize because I have seen some posts about this, but I
First of all I want to mention two things, One: My code isn't perfect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.