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

>>However, I still recommend using highlighted code and pointing out certain lines with the line numbers
Yes I like that feature too. A little aprehensive at first when you first started it but I've grown to really like it because line numbers makes it a lot easier to discuss the program.

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

I want to lear Basics of "C" language..

can anybody help me with that ?

The first thing you need to do is learn to read English. Apparently your skills are lacking in this area because if you knew how to do that then you would have easily found these links. After learning to read you need to know how to comprehend what you read. Without those two skills you might as well go play in a sandbox with your toys.

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

I'm glad to see that you added the "Toggle Plain Text" to normal code tags (those without a language specified). Thanks for making that change :)

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

My GUESS is yes -- here is an example tutorial

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

>>By project file do you mean a *.dev?
No. VC++ 6.0 uses *.dsw for project filenames.
[edit]I just tried to import it and Dev-C++ failed. Probably because it wants a *.dsp and all we get in the glut distribution is *.dsw.

>> And how do you create a dll project?
In Dev-C++ ? Just select File --> New --> Project, then click the DLL project type icon.

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

>>"bypasses initialization of a local varible in function"

That error message is just telling you that you declared a variable inside a switch case statement without braces. Two ways to correct that:
(1) add the braces

switch(something)
{
     case 0:
     {
          HMENU hMenu = /* blabla */
      }
}

or declare hMenu above and outside the switch statement.

What you read in the Borland library documentation, and in the online MSDN is called a function prototype. They do not actually get executed but just tell the compiler the parameters and return value. If you are not familar with function prototypes then you need to read the link I posted because they are very basic to the C and C++ languages and you will encounter them thousands of times in the future.

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

Mary Catherine Roper, a lawyer with the American Civil Liberties Union in Philadelphia, took issue with the citation.

"You can't prosecute somebody for swearing at a cop or a toilet," she said

I think you can get ticketed for swearing at a cop, but when he is off-duty he is probably just like anyone else unless of course there is a real crime being committed. This is only the second time I have seen the ACLU do anything that I agree with.

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

I don't really know, but did you try the obvious ?

for(i = 0; i < 4; ++i)
{
   for(j = 0; j < 4; ++j)
   {
        data[i][j] = gsl_matrix_column(i, j);
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

just remove the "%s" -- its not necessary because adress is already a string that contains the filename

file=fopen(adress,"a+");
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is an example of one way to construct those filenames

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
    string st1 = "file";
    string ext = ".txt";
    string filename;
    for(int i = 1; i < 10; i++)
    {
        stringstream ss;
        ss << i;
        filename = st1 + ss.str() + ext;
        cout << filename << "\n";
        
    }
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

For database support you can use ADOCE from C and C++ programs. The DLL is installed with eVB compiler. It gets the data from a server computer and stores it on the wireless device that it is running on.

As you are finding out (or have already found out) the PocketPC and Mobile 5.0 operating systems are very stripped down versions of MS-Windows.

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

try this:

fout.open("library.txt");
if( fout.is_open())
{
    fout.seekp(0,ios_base::end);
    // blabla
}

If that doesn't work then post how fout was declared.

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

A couple ways to solve your problem:

1. after opening the file call seekp(ios::end); set the file pointer to end-of-file before writing

2. Add the ios::ate flag to the open statement: fout.open("library.txt", ios::out | ios::ate);

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

Oh I see. When you first open the program read the output file into studentAvgQuiz array so that array looks just like it when when the program was shut down. Then when you write it out DO NOT open with the flags I mentioned previously -- if the file exists then you want to overwrite any exting data in it.

1. on program startup open the output file for reading and read all data into the array.
2. close the file in #1 above and reopen for output with the ios::trunc flag to delete all data in the file.
3. write the array to the file like you already posted

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

Here is the best technology

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

The open function does not take std::string object but a char*, so call its c_str() to get it

inFile.open(RES_FILENAME.c_str());

[edit]what Dave said ^^^^[/edit]

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

I assume you want the file to look like this after entering the 4s

0 0 0 0 5 0
0 0 0 0 5 0
0 0 0 0 5 0
0 0 0 0 4 0
0 0 0 0 4 0
0 0 0 0 4 0

As I said before you have to open the output file with ios::ate or ios::app flag otherwise you will get the behavior you are experiencing. Or, if the file is never closed after calling enterQuiz() then at the beginning of that function call seekp() to move the file pointer to end-of-file before writing to it.

quizFile.seekp(ios_base::end);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i can't call any function in the main (don't know how)
almost identical to calling any normal function except you have to reference the name of the object. For example if you want to call search_By_Id() then do it like this

obj.search_By_Id();

setName() is wrong. since Name has been declared as a pointer you need to allocate memory for it. But if you declare Name as std::string you don't have to worry about that. If you want to keep it as char* then code that function like this:

void student::setName(char* x){
       Name= new char[strlen(x)+1];
       strcpy(Name, x);
}

getName() is also coded wrong. It should return a const pointer because its value should not be changed by the calling function. and coded as below.

const char* student::getName(){
    return Name;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

when you open the output file add the ios::ate flag so that the open function will move the file pointer to the end of the exting file data after it opens the file. Normally the file pointer is set to the beginning of the file and if you don't use seek() functions to set it to the end then your program will just overwrite whatever is there. The ios::app flag will always move the pointer to the end of the file for each write and the ios::ate does it only when the file is first opened.

quizFile.open("quiz.dat", ios::out | ios::ate);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 64: That does not call the function but declares a prototype and my compiler VC++ 2005 Express says it is different than that included in windows.h (winuser.h). If your intent was to actually call that function then code it like this:

HMENU hMenu = CreateMenu();
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I didn't want to fill up a thread with a bunch of code, but I couldn't find a way to attach a file to an e-mail using this site's "send a message" system. I would have inserted the .CPP file.

Hit the Go Advanced button then scroll down the page and you will see an option to attach a file. You do NOT send it to DaniWeb via email, but upload it using the options for the Manage Attachments button.

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

setw I think will do it

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    float n = 123.4567890F;
    cout << setw(3) <<  n << "\n";
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 7 has not been corrected yet -- and we have told you about that at least 3 times. And you have not put lines 7 and 8 in a loop either. Do you not know what a loop is ?

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

>>the programm work but i still have one problem
Well then it is not the same as the code you posted above ^^^. Since I can't see your monitor I have no idea what is wrong with it now.

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

i have done it but i still get error.

Yes I can see you did it all right -- you simply ignored all our suggestions. This will be my last post to you until you learn to read and implement our suggestions.

Salem commented: More patience than me, but why do you keep replying ;) +11
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 21 is a syntax error that your compiler should have complained about. Maybe its just a posting error ?

After using scanf() to get an integer, scanf() leaves the '\n' in the keyboard buffer so the next time you call scanf it will appear as if it is not doing anything. The way to correct that is to remove the '\n' after calling scanf for integer input by to call getchar().

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

Please repost your program. And did you make all the changes that we previously mentioned? If not, why not. I can't help you if you continually ignore what we post. If you don't understand the changes we have suggested then just ask for more clarification.

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

what compiler and operating system ? There are lots (if not hundreds) of different embedded operating systems.

>>parameter.par
no idea what that file contains.

In C and C++ languages, a FILE is a structure that is defined in stdio.h and pointers to it are passed to the functions that are also identified in stdio.h. If that is what you are talking about and you don't know how to use FILE then you are not ready to tackle your program. You first need to study some good tutorials or books, or take a college class in C or C++.

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

depends on the operating system. Here is some info for MS-Windows. You'll have to do some more reasearch to find other information.

And why use assembly if you don't have to? A lot easier in other languages such as C or C++.

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

line 1: remove the double quotes.

line 7: I told you what the problem was in that other thread. Go back and read it again.

Correct the above and the other errors will probably disappear too.

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

Oh I see you are back to your old code again ?

>>fehler
what is that? Please write in English on these boards.

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

you have to download the source code from that link you originally posted. It includes a project file that I think can be imported by the dev-c++ compiler. If not then you have to create a dll project and add all the source files to it.

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

That library was build with VC++ 6.0 compiler. The *.lib file is apparently not compatible with Dev-C++ because it wants a *nix-like filename, such as libglib32.a I created a simple c++ project and just added glib.h then compiled. Got the same errors you reported. I tried to add glut32.lib but dev-c++ apparently didn't do anything with it because it doesn't recognize it as a library.

That means you will either have to use VC++ 2005 (Express), VC++ 6.0 (yuuk), or compile the DLL with dev-c++ compiler.

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

Those errors mean you did not add the glut32.lib to your project. If you have added it but still get the errors post your program and I'll give it a try.

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

they are indeed different because one is an array and the other is not -- their size has nothing to do with it.

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

>>the teacher said it should only contain one lineof code.

int flip()
{
    return rand() % 2;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Enter Your Height In Feet And Inches: 5 4
use two variables, not one, something like this

int feet,inches
cin >> feet >> inches;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 29 is wrong

while( fgets (buffer , 20 , pFile) )
{
   // blabla
}

fgets() normally adds the '\n' that is in the file at the end of the input string that you need to strip off. And it would make your life a lot easier if you would put the strings in an array instead of concantinating them into one big string.

while( fgets (buffer , sizeof(buffer) , pFile) )
{
   if( buffer[strlen(buffer)-1] == '\n')
       buffer[strlen(buffer)-1] = 0;       
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I just downloaded the source and compiled with VC++ 2005 Express with no problems using the project that was supplied with the source code. Is it the GLUT source code that you compiled or some file that you wrote?

>>I had to install the *.h, *.o, and *.dll files by hand, but going with the locations specified by the readme that came with the dow
What readme file ? There are several of them. You can put the .DLL anyplace you want as long it is in one of the directories in the PATH statement. The *.h and *.lib files can be anywhere you want, you just have to tell your compiler where to put them if not in one of the standard include directories.

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

If you want to keep all existing values in the array then you need use a loop to shift everything down from the spot you want to add the new value.

[edit]^^^ what Narue said [/edit]

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

that this lib file is there along with other file in the path that i have specified in directories path option

If you mean the PATH environment variable then that is incorrect. The compilers I have used from the command-line all use the -L option to specify path to libraries or LIB environment variable.

If you are using an IDE then we need to know which one because they all do things a little differently.

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

If ponters seem like some strange outerspace alien then you should study some tutorials about them. They are very basic to C and C++ languages and you will not get very far without them.

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

all you did was comress it which to me makes it harder to read. .

Nope -- we didn't do that. In the future please hit the Preview button before posting so that you can see what it looks like.

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

what have YOU tried to fix the problems? Look at the error messages, they tell you what lines are incorrect. Then look up the function in your textbook or online and see why the compiler says you are wrong.

line 13 is wrong -- what is the value of string when it first enters that loop ? Hint: its value is just some random junk because you didn't initialize it to anything. And even if you did initialize it that line would still be wrong.

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

delete line 6 because it doesn't do anything. maybe you forget something there ?

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

>>is it right like this
No.

line 4: coded wrong -- initializers must immediately followint the variable declaration

int b = 4, h = 14;

line 5: remove the if and the space between + and = symbols. Then you need a different variable for the accumulator.

now put lines 5 and 6 inside its own loop so it will make that calculation for each digit in the number.

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

you could change points to be double star then allocate both dimensions

struct pf_path32 {
  Uint32 length;
  struct pf_point32 *points[];
};
path->points = malloc((path->length+1) * sizeof(char *));
// now you can use it like without wasted space

You will need the +1 in the above because you reference like this:

path->points[length]

If length is the same as path->length then you will be indexing out-of-bounds because arrays are numbered starting with 0, so length element will not exist.

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

Header files are often included in two or more program units (*.c files). So if you put executable code in the header file then the compiler will spew out duplicate declaration errors when attempting to link then. By convention (and everybody with more than 1 day's programming experience) will only put structure declarations, typedefs, defines and the like in header files -- and nothing more. Many programs and libraries consist of hundreds of *.c and .h files and trying to compile them all in one *.c file would be a nightmare for even the most experienced programmers.


In your program you should put the executable code in a different *.c file and leave the structures and defines where they are. Now your project will have two *.c files and one *.h file. Include the *.h file at the top of each *.c file, compile both *.c files then link them together as one executable program.

You did not say what compiler you are using so I can't help you any more with that part.

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

your program is missing a closing parentheses at line 18 for funciton input()

line 6: that is normally coded with the asterisk, like this: int *y; .

lines 18 and 30. you have to specify the data types as well as variable names

void sum(int length,int y[], int t, int sum)
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have seen that behavior with VC++ 6.0 on XP os with Norton Antivirus running. Antivirus program prevented the IDE from saving the file successfully.