Visual Studio 2010 Professional
and I am just using notepad to view the file
Type: Posts; User: kulfon
Visual Studio 2010 Professional
and I am just using notepad to view the file
This is driving me crazy, I have the following program:
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
ofstream myfile;
Hi
I wrote some classes inheriting from <exception> in the following way:
class NoFile : public exception
{
public:
NoFile();
NoFile(string);
NoFile(const NoFile &);
Sorry for double posting but I kind of figured out that the error was due to nothing being returned from the catch block, and in the main function nothing was to be assigned to the test2 vector. I...
I am trying to write a getter function from my class, which would return a part of my member variable vector<short>:
const vector<short> Input::getOneRow(int index) const
{
try
{
return...
I am trying to understand the sense of virtual fuctions and so I wrote the following piece of code:
#include <iostream>
using namespace std;
class Base
{
public:
virtual void doit() { cout...
I am writing a C++ application in Visual Studio 2010 which is meant to use MATLAB for graph plotting. In order to do so I added the MATLAB dll directory in my solution:
Properties -> Debugging ->...
Hi, I am writing a program to perform nodal analysis and I need complex input for phasors and impedances. I have declared the variable and I want to read its value from standard input:
complex...
This is an extract from a much bigger program:
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
ifstream input;
I have written a program, which is supposed to read 3 lines from a text file, the first is char, second string and thirs an integer. The input.txt is:
i
Arnold Schwarzenegger
60
And my code:...
So how do I make it work? I do not want it to iterate through one of the switch statements twice after grabbing the last instruction from the file. Should I add another while(command.eof() == false)...
I have written this piece of code:
if(command.is_open() == true)
{
while(command.eof() == false)
{
command >> instr;
switch(instr)
{
case 'r':
Could you explain what this second usage of 'buffer' is supposed to do?
I mean while(temp=buffer.get()), buffer)
Because, before you edited the post I used (completely randomly, without knowledge...
int main()
{
string input = "abc def";
stringstream buffer(input);
char temp;
int i = 0;
char something[20];
while(buffer >> temp)
{
fgets will read only one line of the file, what if there is more and i still want them all in one string?
And that code below works, is that what you tried to tell me to fix?
#include...
This is a typo, ofcourse it should be 1.
Okay, I get that but how to find out in which place of my buffer array I need to put the null terminator?
I want to read a whole text file a once into a single string. I have used the fread() function in the following way:
#include <stdio.h>
int main()
{
FILE *fInp;
char buffer[1000];
fInp...
I am trying to write a program that will compute an angle and magnitude of a given complex number. I have therefore declared an array of 2 floats in which [0] stores the real part and [1] the...