Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

are you asking if you can send the linked list from client to server? Why would you want to do that? Just have the server create the linked list, unless of course the server doesn't have the file to generate the list.

But if the client already has the linked list then it doesn't need the server.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Then why use it since you have to delete them all before releasing the program ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

graphics.h (Turbo C) is something like 20 years old (1987 or so) -- produced long long before the invention of GUI windows and double buffering.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

gloas and cards have to be arrays also so that names[0] is associated with glals[0] and cards[0]

Create the arrays in main() like you did with names, then pass all three arrays to the other functions so that the other functions have access to them, like this

void inputinformation(string names[], int goals[], int cards[])
{

}

line 22: you don't use goals as an index into names

for(i = 0; i < 4; i++)
   cout << names[i] << " " << goals[i] << " " << cardes[i] << "\n";
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I never used OutputDebugString(). It appears to be sort of like assert(), where you can add debugging comments which don't show up when the program is compiled for release mode.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes you can use it, but I won't suggest it. Its a whole lot easier to use fread() and fwrite() to read/write to/from binary files.

// fgetc example
float f = 0;
unsigned char buf[sizeof(float)];
FILE* fp = fopen("myfile.dat", "rb");
// read a float
for(i = 0; i < sizeof(float); i++)
   buf[i] = fgetc(fp);
// move the contents of buf into the float variable
f = *(float *)buf;

Here is the same thing using fread

float f;
FILE* fp = fopen("myfile.dat", "rb");
// read the float
fread((char *)&f, sizeof(float),1,fp);

fread() is a lot less typing, lot less error prone, and more straight-forward.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are using a compiler with the world's best debugger. You don't need debug messages. Just compile your program for debug and use the debugger to set breakpoints, see the value of variables and program execution.

But to answer your question, how to print debug messages depends on whether you are writing a console program or a windows program. Console progrm: just using normal print() or cout statements wherever you want them. Windows programs are more difficult because it doesn't have a console window, so you have to use win32 api text output functions

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

mca -- is that a Master's degree of some sorts? What is your major ? How well do you know c++ language?

c++ projects: there are thousands of them, depending on your level of knowledge.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you don't need an SQL database to save and access user account information. You can do it with simple text files. Why do you think you need winsock? Just use normal file i/o techniques to read the text file, find the user's id, read the associated password and compare it with the password the user entered then logging in.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb where you will get lots of expert help when you post your questions in the Java forum.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at the Rep Power you have -- its 0. You can not give green rep until you get it to 1. I think when you make 10 posts your rep power will go up to 1.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What I posted is also the method used to convert a string of digits to an integer if you don't want to use a standard C or C++ convertion function.

Here's aother way: int c = (a << 3) + (a << 1) + b;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you download the sdl source and compile it with your compiler?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>fatal error C1083: Cannot open include file: 'close_code.h': No such file or directory
It means exactuly what it says it means. The compiler can't find close_code.h ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

int c = (a * 10) + b;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Neat. I couldn't find an option to create an MFC console application when I was looking. Do you just create a win32 app and there's some setting I'm missing somewhere?

*runs off to try that*

That option exists in VC++ 6.0, I don't know if they removed in in 2005 or not. All it is is a standard console application (NOT a win32 application) with the files as I posted.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You didn't answer Niek's question. Which way do you expect to see the data ? If you want it similiar to what I posted then you can't use sprintf(). And the way I posted, one char can only hold a value up to 127 decimal (signed integer). If the values are larger than that then you can't do it my way.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First, there are no free databases for WinCE other than ADOCE and the CDatabase class that is supplied with the C++ compiler. I don't know if you can access that class with C# or not.

The next best thing for you to do is just write your own simple database, which is what I did a few years ago. Its not all that difficult to do.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sequentially read the file line-by-line until you get to the line number you want.

intialize line counter to 0
loop
   read a line
   increment line counter
   Is this the line you want
       Yes, then do something with it and exit the loop
       No, then back to top of loop
end of loop
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Change the %x to %d with the sprintf()
use %c when printing the chars

this code:

works fine for me..

But I think he was expending a[0] to be 31.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sprintf() doesn't work that way. Each digit of the number will be placed in a different element of the character array. So for 0x1f the a[0] == '1' and a[1] == 'f' (assuming "%x")

#include<stdio.h>
int main()
{
    char a[25] = {0};
	int i;
    a[0] = 0x1f;
    a[1] = 0x01;
    a[2] = 0x00271418;
	//sprintf(a,"%4d%4d%4d",0x0000001F,0x00000001,0x00271418);
	for(i=0; i <3; i++)
	{
		printf("%d\n",a[i]);
	}
    return 0;
}
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Can Any one guide me for this.
As a batch file, forget it. Can't be done. There is no way to send anything to an already running program from a batch file. But you can write a C or C++ program to do that and call that program from the batch file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

"%d" will produce decimal. If you want hex then use "%x"

Try this:

int main()
{
	char a[25];
	int i;
	sprintf(a,"%x%x%x",0x0000001F,0x00000001,0x00271418);
	for(i=0;i<8;i++)
	{
		printf("%c\n",a[i]);
	}
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do the parameters print ok when coded like this ? I am assuming you are NOT compiling for UNICODE because if you were you would be getting other problems.

#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    for(int i = 0; i < argc; i++)
        cout << argv[i] << "\n";
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

moved

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Using VC++ 6.0 you can create a console program that supports MFC. This is what the VC++ 6.0 IDE creates in stdafx.h

// stdafx.h
#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers

#include <afx.h>
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>			// MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include <iostream>

And this is the *.cpp file it generates

/////////////////////////////////////////////////////////////////////////////
// The one and only application object
#include "stdafx.h"

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
	}
	else
	{
		// TODO: code your application's behavior here.
		CString strHello;
		strHello.LoadString(IDS_HELLO);
		cout << (LPCTSTR)strHello << endl;
	}

	return nRetCode;
}

Using the above program you can test for yourself whether it will support CWinThread or not.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can always compose your post using some text editor such as Notepad or Word, then copy/paste into a DaniWeb post after you have finished.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't know. Too vague of a question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can not put MessageBox() or AfxMessageBox() inside event handler functions because they behave as you have found -- resursive. Its unfortunate, but that's the way MFC works.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If reading the values from a file you can use loops to fill up the arrays.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>when I try to #include afx.h so that I can build threads via AfxBeginThread I get the following error:

why are you including afx.h ? If you are using a Microsoft compiler and using precompiled headers then that is already included in stdafx.h

>>I was wondering if anyone could tell me how to interface with the MFC libraries in my console application?

Microsoft compilers can generate a console program that accesses SOME MFC (but not all). Console programs are limited to using only no-GUI related MFC classes, such as CString and CFile.

If you want to create threads in a console application use the win32 api function CreateThread().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Government will die if people ceases to exist, but people will not expire if government stops to be.

Prove it. There has never been a time in human history where there was no government wherever more than 2 people live together. You can even consider the basic family as a government of sorts -- mom & dad are the dictators and the children are the governed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

yes, only in America would people willingly vote for a communist Muslim fanatic whose primary goal is to destroy the country he's aiming to be voted president of...

And only in the Neterlands would someone spread such visious false rhumors (lies). A man of your intelligence should be ashmend of yourself.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is the code you posted only a tiny part of some much larger windows gui program ? According to the code you posted PostMessage() doesn't work because there is no window.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

With today's gas prices soaring, going green to include recycled clothing would be a great alternative for folks that just want to be comfortable in what they wear; affordable to the manufacturer and the customer and good (meaning not harmful) to the environment.

Here's an idea -- editable cloths

Grigor Coric suggests we might end up with: organic clothes, nutritious clothes, diet clothes; freshly fashion and farm fashion; plum, apple and watermelon sizes instead of S, M, L; fridges instead of wardrobes; no ironing; “grow your own clothes” movemen.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can not cast wchar_t* to char* because wchar_t data type is normally (but not always) a short int (2 bytes). On *nix machines wchar_t is a long int (4 bytes). Here is one way to make the conversion

do {
       char temp[_MAX_PATH]; // _MAX_PATH is defined as 255
       size_t nconv = 0;
       wcstombs_s(&nconv, temp,_MAX_PATH,ffd.cFileName, wcslen(ffd.cFileName)+1);
       //cout << ffd.cFileName << endl;
       cout << temp << "\n"; 
      cout << "Type = " << ( (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                             ? "dir\n" : "file\n" );
      cout << "Size = " << ffd.nFileSizeLow << "\n\n";
   } while (FindNextFile(sh, &ffd));
raul15791 commented: Knowledgeable +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thanks

Is it just me, or does it seem that c++ is unfriendlier than Java. -_-

Its just you :) I don't know the first thing about java so I don't really know. But you will find such differences in every computer language.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>WriteFile(hCom, data, 2 , NULL, NULL) ;
The third parameter is wrong -- it is supposed to be the number of BYTES, not the number of integers. To send two integers, do it like this: WriteFile(hCom, (char*)data, sizeof(data), NULL, NULL) ; If you only want to send 2 bytes instead of 2 integers

char data[2] = {0x01, 0x02};
DWORD dwBytesWritten = 0;
WriteFile(hCom, (char*)data, sizeof(data), &dwBytesWritten, NULL) ;

And as I said before, THE FOURTH PARAMETER CAN NOT BE NULL.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Never see all that data types before
And you probably won't see them except in windows.h

Here is your program that works on my computer. I changed the path in main() for my computer, and deleted other extraneous/wrong code.

void EnumerateFolderFS(LPCTSTR path)
{
   WIN32_FIND_DATA ffd; // file information struct
   HANDLE sh = FindFirstFile(path, &ffd);
   if(INVALID_HANDLE_VALUE == sh) 
   {
	   return; // not a proper path i guess
   }

   
   // enumerate all items; NOTE: FindFirstFile has already got info for an item
   do {
      cout << ffd.cFileName << endl;
      cout << "Type = " << ( (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                             ? "dir\n" : "file\n" );
      cout << "Size = " << ffd.nFileSizeLow << "\n\n";
   } while (FindNextFile(sh, &ffd));


   FindClose(sh);
}

int main()
{
	EnumerateFolderFS(_TEXT("D:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include\\*.h"));

	cin.get();
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

stringstream (all one word) is a class that acts like fstream but instead of working with files it works with std::string.

line 24: delete that line. you are attempting to set a double to that of std::string, which is not possible. Re-read the code I posted vary carefully.

stringstream str(input);
str >> firstExam;

The above will convert the std::string into a double.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> I know it's supposed to hold the data but what is LPCVOID?
See this list of windows.h data types.

>>WriteFile(hCom, ????, 1 , NULL, NULL)
That is incorrect. Read very carefully about each of the parameters from here.

The second parameter is a pointer to the buffer that contains the data to be written. The next parameter is the number of bytes to be written. The next parameter is a pointer to a DWORD that will contain the number of bytes actually written when the function returns.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>EnumerateFolderFS(L"C:\\Documents and Settings\\skong3
Why are you forcing the string into wchar_t* wide characters? That's what the L does before the string.

Change that line like this and see how it works: EnumerateFolderFS(_TEXT("C:\\Documents and Settings\\skong3\\Desktop\\*.h");") The _TEXT is a macro that make the string either char* or wchar_t* depending on whether you compile your program for UNICODE or not.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could use a std::string for input then convert to double if its not "N".

void compute()
{
	char firstExam;
                std::string input;
	double secondExam, thirdExam,avg;

	cout << "Enter the 1st test score (N to end): ";
	cin >> input; //firstExam;

	while (input != "N")
	{
                      stringstream str(input);
                      str >> firstExam;
		cout << "Enter the 2nd test score: ";
		cin >> secondExam;

		cout << "Enter the 3rd test score: ";
		cin >> thirdExam;


		avg = (firstExam + secondExam + thirdExam) / 3

		cout << avg << endl;

		cout << "Enter the 1st test score (N to end): ";
		cin >> firstExam;
	}
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>would it send 10101010 ?
No. And you want is WriteFile(), not FileWriteValue(), whatever that is.

>>2. Is the second parameter of createFile a boolean?
No. Read the description of each parameter here in MSDN

>>3. Is 'COM2' an array of characters?
Yes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

MS-Windows -- see these Communcations Resource Functons If you read the links they will contain sample programs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

printf() can not be used to display text in a MS-Windows GUI program because there is no console window. Depending on your compiler the simplest way to test it is to compile for debug then set a breakpoint on the printf() line. Another alternative is to create a console window then output text to it (see the console win32 api functions).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use a container such as structure or c++ class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

tutorial

download free VC++ 2008 Express compiler or Dev-C++.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  • No support for DVD drives lacking firmware region coding

That's funny because DVD works in my machine.

  • New monitor needed to view Hi-Definition content

And why is that Vista's fault? My old anolog tv doesn't work with hi-def either, so is that the fault of the local tv stations?

  • Vista will encrypt hard drives by Default

Not a problem -- just turn that feature off.

  • Vista won't work with many graphics cards and will remove games developers' ability to cater for older systems

That was a problem with Vista when it first came out too. So nothing new there.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>BS, PH, CIB
In your signature, what is CIB ? Here is a list of 43 possibilities

Aia commented: Most dissapointing. Specially your reaction to my criticism. What's that bad rep comment necessary? +8