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

given the example in this article and and the example you posted, where "->" represents a linked list, you would have a 2d linked list that looks like below ?

0->2->4
1->3->4
2->5
3->6
6->0

The first number in the pair is the row number, and the second number is a node in the list represented by the row number.

Is that how you define your problem?

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

there are a couple ways to approach the problem.
(1) read the file twice. The first time through determine the number of columns in the 2d array from the "heading" line and the number of rows from the "value" line. Just keep track of the largest row and the largest column. Then rewind the file pointer to that the file can be reread from the beginning and allocate memory for the array, initialize all elements of the array to 0. The second time through the file get the column number from the "heading" line, the row number from the "value" string, then the value to be saved in array[row][col] by converting the remainder of the "value" string to integer.

(2) the second method is similary to the first except the file is only read once. Put each of the strings into an array so that this string array can be read instead of the file the second time through. If you are not comfortable with string arrays then the first method may be best for you.

Once you have the array it is a simple matter to print all its values.

And don't forget to deallocate all that memory before terminating the program.

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

that's what happens then you fix something :cheesy: look at the first eror message and try to find out why MemOffset is undefined. Where did you define it? It must be in one of two places: (1) a global variable, or (2) a variable declared inside the function in which its used.

Fix one error and it may solve several error messages.

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

>> void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len); {

remove the semicolon

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

>> { DWORD OldProt;

remove the '{' character.

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

I think free Crimson editor will colorize that FORTRAN code. But its only an IDE and not a compiler. You need to get a fortran compiler if you want to compile your programs into an executable file.

But here is a plugin for Visual Studio 2005.

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

I suspect the problem is in the PHP code -- I don't know the first thing about PHP. But in C or C++ passing arrays is very common thing to do. Does php duplicate the array before passing it to c/c++ then toss it into the bit bucket after the c++ function returns to php ? From your description it sounds like that is what is happening. Maybe you need to pose this question on the PHP board, not the c/c++ board.

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

since you did not post the exact code I dobt anyone can help you. I hope that is not really the way you declared class H. :eek:

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

you know that it the function returns an int pointer and has one argument

int* foo(int n)
{
  // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This article might help you.

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

Is it possible to create reports using Dev C++?..

Here you go.

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

The destructor is not deallocating enough memory -- it heas a memory leak. For every new[] there must be a corresponding delete[]. You need to add a loop similar to the one that is in the constructor.

As for your problem -- hummm I'll have to think about it awhile. No time right now. Maybe someone else can answer sooner.

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

>>im trying to write a function
please post what you have so far.

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

This question was already answered on another board

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

I all depends on where you live. If you live in Southern California, $200K/year is barly enough to live on. But if you live where I do in the middle of the nation you can live comfortably on 1/4th that.

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

yes there is that option, but the way I understand it is that he only wants to delete selected files/folders, not all of them. Use "rd /s" command to remove all the files and directories in the current tree. warning: do not do this from root directory such as c:\

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

I hate snow -- don't like shoveling the stuff or driving in the stuff. It would not be so bad if the snow fell everywhere except on sidewalks and roads. So I moved south the St Louis missouri a few years ago where the winters are normally pretty mild. We still get a little snow, but nothing like that picture "winter in Germany".

I love spring because that's the time of year when everything comes alive and new things are born. We get a lot of tornados that time of year, but I just ignore them. No hurricanes, and only an occasional earth quake (every 10 years or so).

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

Here is an example that will illustrate the difference between using EOF and 0. In this example, checking for EOF causes infinite loop because end-of-file is never reached due to conversion error. If you uncomment the while statement that check for 0 then the program will stop when conversion error occurs.

When you wrote your programs for school you probably wrote sample data files that did not contain errors. That will not always be the case in real-world.

#include <stdlib.h>
#include <stdio.h>
 
int main(int ac, char** av) 
{
	int a;
	int counter = 0;
	FILE* fp = fopen("myfile.txt","r");
	if(fp != NULL)
	{
		while( fscanf(fp,"%d",&a) != EOF)
//		while( fscanf(fp,"%d",&a) > 0)
		{
			printf("%d\n",counter++);
		}
		fclose(fp);

	}
	return 0;
}

This is sample data file

1
2
40
abc
5a
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you enter a number as argument to the program? Such as:

c:>myprog 15 <Enter>

[edit]sorry ~s.o.s.~ for duplicating your answer.[/edit]

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

>>return x[(count2)+1];
this is wrong. When the loop ends, the value of count2 will be 20. x[21] is referencing too nonexistant elements of the array.

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

you can't actually delete it. you can set it to 0 if you wish, but it will still be there. What you can do is decement the variable that contains the number of elements in the array. Just pretend the array only has 9 elements insead of 10.

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

>> return x[(count2)+1];
the above is on the inside of the loop so the loop will only run once.

>>for (count = 0;count <= 20;count++)
this loop will count one too many times. the array only has 20 elements but the loop will run 21 times.

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

>> return a[count];
the above is inside the loop, so the loop only runs once.

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

>>Release MinDependecy
this means the compiler will use as many static libraries as possible when linking your program -- the program will make minimal use of DLLs. This makes it easy for you to run the program on other computers that may not have all the DLLs that the program needs, but will make the final executable program a lot larger than those which were not compiled this way.

2. You can only debug a DLL through an application program that calls the functions in the dll. I write a small test program that just makes DLL calls.

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

compile your program for debug then when the core file is created use debugger on it to see where the problem is.

Suggestion: your program makes no input validations. How does it know that argv[1] contains an integer between 0 and 20? what happens if I enter 500 as argv[1] ?

int cstr[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};		// stores c-values from distance string
int fstr[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};		// stores f-values from c-str giving probability of page faults

you can simplify the above like below. It is not necessary to specify the initialization of each element of the array because the compiler will set all unspecified initializer to 0 for you.

int cstr[20]={0};		// stores c-values from distance string
int fstr[20]={0};		// stores f-values from c-str giving probability of page faults

>> while (!feof(in))
we have said many many times on these boards that you should not rely on feof() because it does not always catch eof-of-file at the right time. Instead you should code it like this:

while(   fgets(ea, 2, in) )
{
   // blabla
}

Where is pointer ea allocated? I see where it is declared and left unitialized, but I don't see where you allocated any memory for it. That may explain the seg fault you are getting.

for(i=0;i<dsn;i++)
	{
		printf("%d ",diststr[i]);
		switch(diststr[i])
		{

why did you make this do difficult? you don't need that switch statement

for(i=0;i<dsn;i++)
	{
		printf("%d ",diststr[i]);
                if( diststr[i] < 20)
                      cstr[diststr[i]]++;
                else
                       cstr99++;
        }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

kaka: I don't have my crystle ball with me :mrgreen: , so you will have to post the code and a few of the error messages. Also tell us what compiler and operating system you are using.

Sorry, I'm not into programming calculas formulas. But maybe some of the other smart members can help you with that.

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

No, there are many things you can't see at design time. You might google for another resource editor which might have what you want, but I doubt that you will find one.

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

Use counter which will print the chars.

The second question also can solve with counter.

Yes, that is a better solution than mine -- doesn't require a second buffer.

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

>>Now, for a member function to be virtual in a class, both the base class AND derived class must be able to be instantiated

Not really. The base class can have pure virtual functions which means it can not be instantiated on its own. The derived class(s) must override pure virtual functions, while it is optional to override the others. A class can have both virtual and pure virtual functions.

>>Don't make a habit of using virtual in any function because "you may need to overload it later on".

Base classes do not always know if the derived classes need to override the virtual functions, so I see no harm in making virtual functions even though the programmer may not know if they are needed or not. I think the main idea here is: does the base class want to allow derived classes to override the function? If yes, then make it virtual.

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

you will need a second char array. copy the first 43 characters to this second char array array then print it. then print the remainder of the original array.

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

thank you to joeprogrammer and ancient dragon...to ancient dragon..its right just as you wrote...for the sum symbol...actually its not integer that ll be sum but its data array...

In that case, use the loop counter as index into the array

int array[255];
...
...
sum += array[i];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The link error is telling you that you forgot to code the function getData(). This is not a standard C function -- you have to write it yourself.

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

If I remember my calculas correctly (mind you its been over 35 years), problem 1 is asking you to calculate the sum of all the numbers between 0 and some maximum value, that you will probably enter from the keyboard. If that is true, your program will need an integer that accumulates the sum and it will need a loop that counts from 0 to N-1.

I don't recall what the second problem means.

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

Q: Why did the man wear his glases to bed at night?

A: So he could see his dreams in technicolor :mrgreen:

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

Check out this MFC control:)

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

batch files are generally pretty simple-minded things, not at all as powerful as *nix shell scripts. For more complicated tasks you would be better off writing a program in some other language, such as C or C++.

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

>>while (fscanf(c,"%d",&a)!=EOF){

fscanf() does NOT return EOF one eod-of-file. EOF is returned only if there was a conversion error. What you want is this:

while (fscanf(c,"%d",&a) > 0){
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is an example of how to use map. All it does is associate a number with an instance of PluginInfo object.

#pragma warning(disable: 4786)
#include <windows.h>
#include <iostream>
#include <string>
#include <map>

typedef enum _RequestCode
{
	cPluginInit = 1,
	cPluginQuit = 2

} RequestCode;

typedef long (*ServiceFunc)(UINT, RequestCode, UINT_PTR, ULONG_PTR);
typedef long (*PluginCallback)(RequestCode, UINT_PTR, ULONG_PTR);

typedef struct _PluginInfo
{
	std::string PluginName;
	std::string PluginAuthor;
	int Flags;
	PluginCallback Callback;

} PluginInfo;

std::map<UINT,PluginInfo*>  theList;



int main()
{
	PluginInfo* info = new PluginInfo;
	theList[1] = info;
	PluginInfo* pinfo  = theList[1];
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Why the use of eof is a bad option?
because it can cause the loop to run too many times. eof is not detected until there is an attempt to read. When the last byte is read from the file eof() has not yet been reached.

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

Here is one you should bookmark.

Plugin.h should be using std::string objects instead of char* -- it will make your life a lot easier because you don't need to allocate memory for those strings. Look over your code and see where else you can substitute std::string for char*.

typedef struct _PluginInfo
{
	std::string PluginName;
	std::string PluginAuthor;
	int Flags;
	PluginCallback Callback;

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

this is obviously a c++ program so why don't you use a c++ container such as <map> to house the plugins? Other than that, its hard to say what your problem is because you did not post enough code. It would be helpful if you just zipped up all the files and attached it to your post.

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

your like does not work.

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

I have a logging program that changes the filename every day. Whenever the log function is called it creates the filename based on the current system time. Example:

char filename[255];
time_t now = time(0);
struct tm* tm = localtime(&now);
sprintf(filename,"%02d-02d-04d.txt", tm->tm_day, <snip> ...);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> and PLEASE PLEASE do not post YELLING post at me for wrapping the code because I don't know what that is

Ok then you need to learn. See the links in my signature which will show you how to do it.

>>a for structure
there is no such thing. What you mean is a for loop. A structure is an entirely different thing.

>>How do I have the user of the program enter the number of values before the loop
just put a prompt above that loop and ask how many integers to you want to enter.

>>for(i=0;i<5;i++)
replace the value '5' with x, which was entered from the above prompt.

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

First, this is not the right board to be discussing C and C++ topics. There are several tutorials, the topic is just too complicated to explain fully here.

You might be better off getting free masm assembler and use Notepad to write your programs. I hope you are studying an Intrudoction to Assembly book because you will definitely need it.

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

For your own santity why don't you break up that HUGE string into several lines to make it easier for you to read. Example: Note that each line starts and ends with quotes and does not have a line terminator semicolon.

sprintf(query1, "select a.MobileNumber, a.MasterNumber ,"
"a.MasterAccNo, b.Addr, b.Addr2, b.Addr3, b.Addr4, b.Addr5, b.Addr6,"
"b.Addr7, b.Addr8, b.Postcode, b.CountryCode, b.BillName, b.CorrName,"
"b.ICNew, b.ICOld, b.Passport from Register as a, Profile as b"
" where a.MasterNumber = b.Number and a.MasterNumber = '%s' and"
" a.Status=0", MasterNo);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can download barcode fonts for MS-Windows

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

Ok, so here's a spin off of the previous. If I wanted the user to only have say 20 seconds to enter text in an edit box before it grayed out, how would I go about that?

Sleep()

causes the program to pause, so what would I use?

You can't use Sleep() in that situation because Sleep will not allow the user to do anything during that time. I have not tried it but I think you can use sometime like this example which is implements a timeout for MessageBox. In a nutshell, you set a timer to kick off in 20 seconds. In the timer event check of the user has typed anything in the edit control and if not then send the control a WM_CLOSE message.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
for(y = 0; y < 80; y++) //#of employees could reach 80
            {
                for(x =0; x <30; x++)//30 is a max length for names
                {
                fichier.getline (Noms[x], 50, ':');

1. If 30 is the max length for names, why is getline() reading 50 characters?

2. The for( x = ... loop is not necessary. You only need the Y loop.

for(y = 0; y < 80; y++) //#of employees could reach 80
            {
                fichier.getline (Noms[y], 30, ':');

3. you need another getline() call inside that loop to read the mainder of the line.

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

read this tutorial