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

First write the select statememnt

SELECT * FROM Books
WHERE Number = 123 // or whatever number you want

Put that into a string and pass the string to the query statement function. When that function returns your program will have to loop through the MySQL's result set -- there may be 0 or more rows.

Read through some of those tutorials I gave you and you will find out how to do that.

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

scanf() leaves the Enter key '\n' in the keyboard buffer, so the next time scanf() is called it will only see '\n'. One solution is to replace scanf() with fgets() which will remove '\n' if there is room in the input buffer.

Something like this:

int main()
{
   char answer[255];
   fgets(answer, sizeof(answer), stdin);
   if( answer[0] == 'y' )
   {
       // blabla
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>use void main(void) instead!!!

Never ever use void main() because the only return value stated in c and c++ standards is int. main() will return an integer whether you declare it like that or not. Of a return value is not specified then the function will return 0.

If your compiler produces a warning then just add a return statement.

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

Do you know SQL? If not then you will have to read an SQL tutorial There is no one-line C solution for your question.

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

>>can u just tell me a step by step procedure..plzz...
Nope -- I can't help you with that because I don't use that ancient crappy compiler. Its possible the version of the compiler you have doesn't support multiple files.

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

What GUI to use will depend on the operating system. For MS-Windows you have several options -- win32 api functions, wxWidgets, QT. Other compilers will also provide other options.

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

try running that system function on a line all by itself.

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

What compiler are you using? Generally it is not a good idea to mix C and C++ code together in the same program.

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

Start a new project that only contains main(). The errors you posted appear as if there are other *.cpp files in the project.

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

>>Umm... can you export your settings and send them to me so I can import them?

AFAIK that is not possible. You might want to post your question at Microsoft's forum

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

How long has that been happening? Just recently or a very long time? Did you install something that may have affected the compiler's installation? Try reinstalling Visual Studio, uninstall it completely first so that it will reinstall fresh.

Does kernel32.lib actually exist on the computer?

[edit]Oh, I reread your post and see you may have already tried that. Do you also have the Platform SDK installed? If you do then remove it then reinstall it.

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

No I didn't -- the return statement in main() is optional.

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

Ok -- here's the basic code

#include <stdio.h>

int main(int argc, char* argv[])
{
   printf("Hello World\n");
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Why is line 80 inside that if block? What good does it do? Line 80 declares an array of pointers which immediately goes out of scope and is destroyed.

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

My guess is that you failed to create a project. Read this thread

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

clients ask information from servers, not the other way around. In your case your server is acting as the client, and the clinets are the servers. So you have one client with many servers.

Or you could have the clients periodically push the information to the server intead of having the server pulling the info from each client.

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

same problem as I mentioned before -- you forgot to include a header file, in this case it was string.h. You can't call functions if they have not been previously declared.

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

How to combine then is also obvious -- just use strcat() to combin them.

>>using words like "what the hell" is not a productive way in any discussion,
This is an adult forum for adults -- so act like one and don't get that offended.

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

For [code?] on line 19: why don't you just strcat the two strings together? Since you have not posted the contents of each of those strings and what you want the result to be, how in the hell do you expect me or anyone else to tell you what you have to do to combine them???

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

Compilers like to puke out a lot of errors for the same line. And an error on one line can spew out a lot of errors on other succeeding lines. So in practice I generally fix the error at the top of the list then recompile to get a new list of errors.

>> warning: format '%i' expects type 'int',
Look at the format specifications and you will probably find that you need to use %ld for long int.

>>warning: incompatible implicit declaration of built-in function 'malloc'
Most likely you forgot to include a header file.

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

The parameters are mapped in the order in which they appear in the argument list. The first parameter on line 11 (a) is mapped to the first parameter on line 3. The second parameter on line 11 (b) is mapped to the second parameter on line 3. That mapping can go on almost indefinitely.

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

People are not here to write your programs for you or do your homework. Hence we say "do this" or "do that" instead of giving out actual code.

The first thing you need to learn is how to use google and read MSDN. google for the function and you will find out for yourself what those parameters are. You have a brain just as good (maybe even better) than mine -- so learn to use it for something other than a hat rack.

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

Here you go

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

My GUESS is that your program contains bugs that went unnoticed or undetected under UNIX. Post the code.

[edit]Nevermind -- glad you found the problem :) [/edit]

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

@Qusto: that link is broken

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

First make a structure that contains a function pointer and a text string

struct functions
{
    void (*fn)(); // function pointer
    char* function_name;
};

now make an array of those structures for each of the functions you want to call from the command line arguments. Then for each command-line argument the program can loop through that array and find the desired array element that contains the function pointer to be called. You might be able to also implement this as a <map>

200 functions is a little lengthy so I'd probably put that array in a *.cpp file all by itself so that it would be easier to maintain.

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

>>excellentcool

I'll bet text1 is not terminated with a '\n' (or Enter key) after the last line in the file

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

Well then do it in another language such as awk. Hell, if you are on MS-Windows you can even do it in a command prompt c:> copy file1+file2+file3 file4

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

>>Wow are you serious?

Absolutely dead searious. The problem does really exist. :@

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

>>If anyone has the actual code would they be able to paste it in?

Nope -- not happening here at DaniWeb. We don't do people's homework assignments for them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ketsuekiame commented: I'll have to bookmark that one :) +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post the first couple errors so that we can help you decipher them.

I can tell you right now that line 27 and 66 are wrong. Must be like this: void MovieDisplay(MovieData m1, MovieData m2) But then even that does not satisfy the program requirements. You have to pass the structures ONE at a time to that function, not both at the same time. Therefore that function should only have one parameter, not two.

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

line 1: its int main() never ever void main()

line 7: feof is a function and it needs to be written as feof()

line 9: why are you using cin to read from a file? cin gets information from the keyboard (YOU type the characters) not from the file.

lines 10 and 11: That is just assigning those from some variables that are already in memory. It is not reading the data from the file at all. You might as well juse use a crystle ball to get the data for that binary tree.

Try calling fgets() to read the information from the file.

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

Microsoft decided to hide that menu on you thinking that programmers are too dumb to know how to use it. To activate the Build menu click on Tools --> Settings then select Expert.

jonsca commented: Good one, I hadn't stumbled onto that yet +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are a couple ways to do it.

open file 1 for input

open result file for output

read each line in file 1 and write it to the result file. getline() will help you with that.

After done, close file 1 -- leave result file open

Now do the same thing with file 2.

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

I doubt that would be all that difficult -- sort of like picking a them for your windows computer desktop. The only thing I would make optional is the color selection -- fonts and other layouts would remain static as they are now. I personally don't like the purple, would rather have the colors of the previous version.

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

It's a start -- needs to stand out more because I had to hunt around for it. I liked the Start New thread button that was at the bottom of the page -- just should have simply moved it to the top.

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

what compiler and/or IDE are you using and what operating system ? How to link two or more *.c object files will depend on the compiler and/or IDE.

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

One more hint: you will need to know 4th grade math (add, subtract, multiply, and divide). What firstperson posted (except for the mod operator) was nothing more than what a 4th grader would learn in most USA schools.

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

Got past that but now I'm having runtime problems because of missing DLLs such as openal32.dll and libsndfile-1.dll. I found out where to get openal32.dll but I have not yet discovered where to get libsndfile-1.dll.

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

I'm running 64-bit Windows 7 and can not successfully compile the example program pong.cpp because of unresolved external linkage for sf::Font::ourDefaultCharset. I've included every library in the package but no luck.

From what I read on their forums it appears the programs do not yet work with Windows 7.

[edit]Scrath that ^^^ it was my fault for not defining SFML_DYNAMIC

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

I downloaded the binaries for vc++ 2008 and got this simple tutorial to work with vc++ 2010 express. I had to copy the dlls into a directory that is in my PATH environment variable -- in my case I could have added the path but I chose to copy the dlls into c:\windows directory.

Post your program and I'll see if I can duplicate your problem.

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

Did you compile the SFML libraries yourself from source or download one of the binaries? I went to their site and did not see a binary version that was built with vc++ 2010.

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

If your program can already read random memory locations then what's the problem? You have to know the address before you can read it. Just be aware that any given address in your program's memory is a virtual address, not a real RAM memory address. A program can not normally read memory outside its own address space.

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

Use mod % and division / operators. Since this is homework, sorry but I'm not going to say anything more about it until you post the code you have tried.

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

Parsing the data file is very very simple approach. And it would be a lot easier than typing all those millions of command-line arguments every time you want to run that program :) Make the text file as simple or as complex as you want -- its all up to you how you do it and what your program requirements are.

First you have to figure out what you want the program to do before you can figure out what the command-line arguments are or how to design the text file that contains those arguments. Just saying "i want a million arguments" is a waste of time.

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

>>it possible to call millions of functions by specifying strings in command line arguments? I think no

And why not? Just extend the example I posted to include several million methods in the classes. Of course the methods have to be known at compile time and your compiler may put a limit on the size of the executable.

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

Then just attach the *.cpp files. If you are using the quick editor, Click the "Use Advanced Editor" button, scroll down and click the "Manage Attachments" button.

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

Use a different compiler and come into the 21st century. That compiler can not be used to access win32 api drawing functions.

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

And for god's sake format your code so that we can read it! No one is going to read all that unformatted crap.