|
I'd like to write a command line program that expands command-line arguments just like typical DOS commands, like dir/ren/copy etc.
For example, if I typed "myprog *.doc" my program would get as its arguments the filenames of all doc files in the current directory.
I suppose I could write my own code to do this, but it seemed pretty standard and I was surprised to not find other code that does this.
-Ben
|
|
|
|
|
I think there's an API which takes that string and returns all the files to match.
If not, there's always this[^].
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I know there is an Internet&Networking category, but most of the articles there are for Windows.
Can someone guide me, or tell me a book, on Internet(Server/Client architecture) programming which is independent of the OS is running on?
Thanx!
|
|
|
|
|
sir,
i am confused about virtual functions, what is neccessity of virtual function.in which conditions we make fuctions as virtual .plz tell me about virtual functions
|
|
|
|
|
This question has already been answered here[^]
|
|
|
|
|
sorry I am not good know english.
Hey All friends please Help me.
how write voice Server and client. and client is not one. I am used several client. if All client online I am Look in server.
knowledge -> friends -> Good Team
|
|
|
|
|
read some books
go to school
|
|
|
|
|
horIter[i]->ver !=NULL;
i get this syntax error
250 H:\Dev_Cpp\project\Comp125\ass3\SparseMatrix.cpp base operand of `->' has non-pointer type ` listNode'
what i do to inlcude i via the for loop
|
|
|
|
|
We have absolutely no idea what horIter is, neither which for loop you are talking about !
Now, look at the error message and it should tell you the answer. I suppose you have to change the line to
horIter[i].ver != NULL;
|
|
|
|
|
You should dereference an iterator and use it from there, you should not assume that an iterator is a pointer. VC6 will let you do this, VC7 ( correctly ) will not.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can someone please help me resolve this question because it is driving me mad. i have been working on it for days and still have nothing.
The question is:
To find value of the sum S for which formula composed. Summation (The act or process of adding) to continue until next composed |a[i]|> E.Ispolzovat a heading file and indexes on function for calculation composed under the formula and indexes on a variable.
I know i have to create a formul but i can't see how if some can help please do beacuse i been working on this for 2 weeks, so please please help.
please help
Jannet
|
|
|
|
|
Your question is hard to understand. Please try to explain it a little better.
|
|
|
|
|
Ask your tutor. That way, he/she will know where you are stuck, and perhaps be able to tailor the lessons so that you can follow them.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
int array[] = {9, 8, 5, 4, 1, 4, 2, 8, 7, 8};<br />
int sum = 0;<br />
int n = sizeof(array)/sizeof(array[0]);<br />
for (i = 0; i < n; ++i)<br />
{<br />
sum += abs(array[i]);<br />
}
that should get you started.
read some books, ask your teacher or teacher's assistant for help. go to the computer lab. find a computer club on campus.
|
|
|
|
|
Thanks for your reply. The example you have posted is great. I think im kind of getting the hang of it.
Thanks very much for your help ahz.
|
|
|
|
|
I have an old library that exports a very nice native C++ object model. Its used in a lot of places that won't allow me to switch this to a managed model. However, we're writing a new GUI that we would like to display the information in a .NET grid. So, we need to somehow wrap this in a datasource. Is there an easier way to do this than write a full managed object model wrapper (i.e. just a simple DataSource wrapper that translates between the two)? I'm looking for examples but not finding any.
|
|
|
|
|
I am looking for C++ Software Engineers who may be interested in or have experience working with Radar. If you are interested and live not too far away from Cypress, CA, I would appreciate if you would respond and include your contact information for me to give you a call or e-mail you. I am not a headhunter. The basic requirements are below.
BSEE/BS/Computer Science
RADAR-- Experience in this area is very much desired but if you have the skills and experience and would be excited about working in this arena we are willing to work with you.
Experience in C++ (3-5 years)
WindRiver "Tornado" a plus
VxWorks desired.
GUI
Familiar with DSP
Laura
|
|
|
|
|
You can contact Laura at lalunelamer@aol.com
|
|
|
|
|
I am doing some responsive UI stuff in my program, and my (ThreadPool) thread needs some information from the UI, so it has to call Control::Invoke to get the main UI thread to do some querying... This method passes back some status information through the return value, and I can get the ThreadPool thread to do various actions based on the state... My problem is, sometimes I need more than one piece of information, and would like to pass this additional information out through pointer parameters of the method... Now, the Control::Invoke method has the signature (the one of importance to me):
public: virtual Object* Invoke(Delegate*, Object[]);
So I have to stick the parameters for the method to be invoked into an Object[], which means boxing value types... However, for the pointer arguments (where I expect to get further information passed back out), this is where I'm having problems... I can't use the pointer directly, and I can't box it... I tried using the System::Reflection::Pointer::Box() method, but then I couldn't use the pointer as expected in the method... Maybe I was doing something wrong, but I would unbox it, then manipulate it... Do I need to box it back up before the function terminates, then unbox it again after the Control::Invoke call to get the value stored there...??? Am I missing something...??? Is there another way to do it, or is this a lost cause??? Any help would be greatly appreciated!!! Below is a pseudocode summary of my problem... Thanks...
- istrasci
<br />
On ThreadPool thread:<br />
{<br />
...<br />
System::Int32 status;<br />
int *val;<br />
args[0] = __box(some_val); ...<br />
args[3] =
<br />
status = *dynamic_cast<System::Int32*><br />
(Invoke(myDelegate, args));<br />
...<br />
}<br />
<br />
On main UI thread:<br />
System::Int32 method(int a, int b, int c, int *d)<br />
{<br />
*d = int3;<br />
<br />
return <status info>;<br />
}
|
|
|
|
|
Sorry, this part should have said (it wouldn't let me edit post for some reason)
<br />
|
|
|
|
|
Hi everyone!
I used AfxGetApp()->LoadCursor() to load cursors from resource. It worked well when I build project using 'Use MFC in a Static Library'.
But when I build it using 'Use MFC in a Shared DLL' - LoadCursor() returnes NULL and GetLastError() returnes ERROR_RESOURCE_TYPE_NOT_FOUND .
But LoadCursor(hInstance, MAKEINTRESOURCE(...)) works as well.
What it can be?
Something similar are happen with menues. CMenu::LoadMenu(...) became unsuccess.
Thanks for help.
-- modified at 14:54 Monday 17th October, 2005
|
|
|
|
|
My test program doesn't seem to work properly. Meaning I'am having trouble calling the functions. I have written an implementation file defining all the member functions of the header-file, yet when I try to call my functions in my test program i get some syntax error. Can anyone please help me. Below I have included 3 pieces of my code all in respect to project
(SparseMatrix.cpp, SparseMatrix.h, and MatrixTest.cpp) please make any adjustments to current code where see necessary.
<code></code>
//The class sparseMatrix uses double-lined list to perform basic
//matrix operations.
//File: SparseMatrix.cpp (implementation file of class SparseMatrix)
#include "SparseMatrix.h"
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
SparseMatrix::SparseMatrix();
//default constructor, creates
//an empty matrix of dimensions 0 x 0
{
numRows = 0;
numCols = 0;
horIter = NULL;
verIter = NULL;
SparseMatrix::SparseMatrix(ifstream &inputFile);
//constructor:
//creates a double-linked list for
//matrix stored in the inputFile
{
//inputFile.open("Matrix1.txt");
//inputFile.open("Matrix2.txt");
listNode* horIter;//declares a pointer variable horIter of type listNode
listNode * verIter;//declares a pointer variable verIter of type listNode
int arow, acol, avalue;
inputFile >> numRows;
inputFile >> numCols;
listNode * previous;
//creating the first node - need to update horIter
listNode * current = new listNode;// this will hold the address of the current node
inputFile >> arow >> acol >> avalue;
current -> row = arow;
current -> col = acol;
current -> value = avalue;
horIter = current;
previous = current;
//from the second node... the rest
while(inputFile >> arow >> acol >> avalue && !inputFile.eof())
{
current = new listNode;// this will hold the address of
// the current node
current-> row = arow;
current-> col = acol;
current-> value = avalue;
current-> hor = NULL;
previous -> hor = current;
previous = current;
}//end while
node * last = current;
current = current -> hor;
current -> col = last -> col;
last -> ver = current;
current = verLinks();//returns the pointer to the first node in the column-by-column order
//verIter = verLinks();//Takes the list with horizontal links
//pointed by horIter and updates it by adding vertical links.
//Returns the pointer to the first node in the order column-by-column.
}
SparseMatrix::~SparseMatrix() //destructor
{
nodeType *temp; // pointer to deallocate the memory occupied by the node
while (horIter != NULL) // while there are nodes in the list
{
temp = horIter; // set temp to the current node
horIter = horIter->hor; // advance first to the next node
delete temp; // deallocate the memory occupied by temp
}
verIter = NULL;
numRows = 0;
numCols = 0;
//delete listNode;
//destroyList();
}
/*inline int SparseMatrix::getNumRows() const
{
return numRows; //returns the number of rows of the matrix
}
inline int SparseMatrix::getNumCols() const
{
return numCols; //returns the number of columns of the matrix
}*/
SparseMatrix SparseMatrix::addMat(const SparseMatrix & M) const;
//returns a new object that is the sum
//of two sparse matrices: this one and M
{
node *face1, *face2;
int pt;
int m =numRows; //rows1 and cols1 are stored size of matrix 1 when call init_matrix1
int n =numCols;
int m1 = M.numRows;
int n1 = M.numCols;
/*if ((m!=m1) || (n!=n1))
{
box_str("Size of matrices is not the same !!");
return;
}*/
matrix a(numRows,numCols);
for (int i=0;i<m;i++) // matrix M
{
for (int j=0;j<n;j++)
pt=0;
if (horIter[i]->ver! = NULL)
{
face1 = horIter[i]->ver;
while (lead1! = NULL)
{
if ((face1->row == (i+1)) && (face1->col == (j+1)))
pt = pt + face1->value;
face1 = face1->ver;
}
}
if (M.horIter[i]->ver! = NULL)
{
face2 = M.horIter[i]->ver;
while (face2!= NULL)
{
if ((face2->row ==(i+1)) && (face2->col ==(j+1)))
pt = pt + face2->value;
face2 = lead2->ver;
}
}
}
return T;
}
SparseMatrix SparseMatrix::multiplyMat(const SparseMatrix & M) const;
//returns a new object that is the product
//of two sparse matrices: this one and M
//if two matrices have incompatible sizes,
//returns an empty matrix of dimensions 0 x 0
{
node *face1, *face2;
int pt, m1,n1;
int m = numRows; //rows1 and cols1 are stored size of matrix 1 when call init_matrix1
int n = M.numCols;
/*if (numCols! = M.numRows)
{
box_str("Sizes of matrices are not allow for multiplication...");
return;
}*/
matrix T(numRows,M.numCols);
for (int i=0;i<m;i++)
{
if (horIter[i]->ver!=NULL)
for(int k=0;k<n;k++)
{
pt=0;
face1=horIter[i]->ver;
while (face1!=NULL)
{
face2 = M.verIter[k]->hor;
while (face2!=NULL)
{
if (face1->col==face2->row)
pt = pt + face1->value*face2->value;
face2=face2->hor;
}
}
face1=face1->ver;
}
}
return T;
}
void SparseMatrix::printMatrix(ostream &outStream) const
//prints the matrix row by row to the output
//stream outStream
//to print to stdout use: printMatrix(cout)
{
listNode * current //declares a pointer variable current to hold the address
current = horIter //of the current node
while(current!=NULL) //there is a least one node
{
outStream << current ->row->col->value <<" ";//display matrix row by row
outStream = outStream -> hor; //process the next node in list
}
outStream << endl;
}
listNode * makeNode(int row, int col, int value)
{
listNode * p;//declares a pointer variable p of listNode
p = row; //allocates a single node, p with the row
p = col; //allocates a single node, p with the row
p = value; //allocates a single node, p with the row
return p; //returns a pointer to the node
}
listNode * verLinks()
{
listNode * verIter; //declares a pointer variable verIter of type listNode
//(pointer to the list traversing row by row)
inputFile >> m; //rows
numRows = m;
inputFile >> n; //cols
numCols = n;
listNode * previous;
//creating the first node - need to update verIter
listNode * current = new listNode;// this will hold the address of the current node
inputFile >> arow >> acol >> avalue;
current -> row = arow;
current -> col = acol;
current -> value = avalue;
verIter = current;
previous = current;
//from the second node... the rest
while(inputFile >> arow >> acol >> avalue && !inputFile.eof())
{
current = new listNode;// this will hold the address of
// the current node
current-> row = arow;
current-> col = acol;
current-> value = avalue;
current-> ver = NULL;
previous -> ver = current;
previous = current;
}//end while
return current;
}
<code></code>
<code></code>
//In particular, program must accept two command-line arguments that are names of two
//files containing the entries of the corresponding matrices
//(with the same format as used in the files Matrix1 and Matrix2).
//program must produce the sum of the two matrices on the standard output
//(or write the phrase Incompatible sizes if the two matrices cannot be added).
//Also program must ADDITIONALLY produce the product of the two matrices on the
//standard output (or write the phrase Incompatible sizes if the two matrices cannot be multiplied).
//File: MatrixTest.cpp
#include "SparseMatrix.h"
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream inputFile;
ofstream outStream;
inputFile.open("Matrix1.txt");
inputFile.open("Matrix2.txt");
cout <<inputFile<<endl;
SparseMatrix T; //declares an object of the class SparseMatrix
????????????????
//ifstream & inputFile //char fn[LGMAX+1];
//gotoxy(5,24);
//cout<<"Write to file:";
//gotoxy(7,25);
//gets(inputFile);
//T.write_file(inputFile);
//T.write_file1(inputfile);
//gotoxy(22,2);
cout<<"The first matrix is "<<endl;
//getch();
//gotoxy(22,2);
cout<<"The second matrix is "<<endl;
//M.display();
//getch();
//gotoxy(22,2);
cout<<"The result of addition of Matrice is "<<endl;
printMatrix(); ???? get syntax error why
cout<<"The result of multiplication of Matrice is "<<endl;
inputFile.close();
system("PAUSE");
}
<code></code>
<code></code>
//The class sparseMatrix uses double-lined list to perform basic
//matrix operations.
#ifndef SparseMatrix_H //preprocessor directives
#define SparseMatrix_H //to avoid multiple inclusions
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
struct listNode
{
int row; //row index
int col; //column index
int value; //entry of the matrix for (row,col)
listNode *hor; //pointer for the horizonal traverse(hor is the link)
listNode *ver; //pointer for the vertical traverse(ver is the link)
};//struct listNode
class SparseMatrix
{
public:
SparseMatrix();
//default constructor, creates
//an empty matrix of dimensions 0 x 0
SparseMatrix(ifstream & inputFile);
//constructor:
//creates a double-linked list for
//matrix stored in the inputFile
~SparseMatrix(); //destructor
inline int getNumRows() const { return numRows; }
//returns the number of rows of the matrix
inline int getNumCols() const { return numCols; }
//returns the number of columns of the matrix
SparseMatrix addMat(const SparseMatrix & M) const;
//returns a new object that is the sum
//of two sparse matrices: this one and M
SparseMatrix multiplyMat(const SparseMatrix & M) const;
//returns a new object that is the product
//of two sparse matrices: this one and M
//if two matrices have incompatible sizes,
//returns an empty matrix of dimensions 0 x 0
void printMatrix(ostream & outStream) const;
//prints the matrix row by row to the output
//stream outStream
//to print to stdout use: printMatrix(cout)
private:
listNode* makeNode(int row, int col, int value);
//returns the pointer to a node with
//initialized entries or NULL if failed
listNode* verLinks();
//Takes the list with horizontal links
//pointed by horIter and updates it by
//adding vertical links.
//Returns the pointer to the first node
//in the order column-by-column.
int numRows; //number of rows in the matrix
int numCols; //number of columns in the matrix
listNode* horIter; //pointer to the list traversing row by row
listNode* verIter; //pointer to the list traversing column by column
};//class SparseMatrix
#endif
<code></code>
|
|
|
|
|
|
After reading some articles I convinced that C# (.NET 2003)is not good enough yet for heavy array operations. Therefore, I want to use VC++ 6.0 for array operations and C# for GUI applications. How can I use them together?
Thank you in advance
Nuray
|
|
|
|
|
Would it be simpler to use VC++ 2003 (native) for both?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|