repost your header file
There should NOT be a semicolon at the end of #define statements -- recheck the defines in your header file to make sure semicolons do not exist. lines 13-16 contain semicolons, which is wrong.
repost your header file
There should NOT be a semicolon at the end of #define statements -- recheck the defines in your header file to make sure semicolons do not exist. lines 13-16 contain semicolons, which is wrong.
Nice photos :) What country is it in?
free() does not change the pointer, it still points to the now-freed strings. Try this
for(index=0;index<50;index++)
{
free(report[index].name);
report[index].name = NULL;
report[index].score=0;
}
Also note that NULL refers to pointers, not integers. If you want to initialize an integer to 0 then do that instead of using NULL. Some compilers define NULL like this:#define NULL (char *)0
The one word I really really hate is banned here -- the F word. I know people who can't say a sentence without saying it and it drives me up the wall. My mother would have washed my mouth out with soap if she herd me saying that word, and I wouldn't be able to sit down for a week either.
I also don't like it when people say $1Million words when they could have just as easily said a $1.00 word. For example: "depict". I once worked with a woman who's job was to give speeches, and she said that word constantly. I tried to get here to use the word "show", but she wasn't moved. Oh well.
So when my program is launched the global class does not have the data to use
Then I suspect you need to reorginze the logic of your program. Function foo() can't do it's job if the data doesn't exist yet.
In the header file, try putting code gards around it like this:
#ifmdef MYHEADERFILE
#define MYHEDERFILE
// your code goes here
#endif
Most likely, but that won't happen anytime soon, if it ever happens.
Probably about a 4 hours or so. I'm not on DaniWeb now as much as I used to be -- too busy playing Diablo III.
What compiler and operating system are you using? The code's formatting is the most horrible that I've seen posted here in the past 10 years! Format it properly and someone might actually try to help you.
Did you use your compiler's debugger so that you can see exactly what is happening? I can't answer your question without having a copy of card.raw and debugging your program.
If it reads 512 bytes, then backs up 4 bytes, what makes you think that the next 8 bytes will be the same as what that if statement expects? Is the size of the file evenly divisible by 512?
The function is being called. I used VS 2012 to verify that. What did you enter for the filename? Why do you think that function is not being called? The program seems to freeze probably because there is an infinite loop. Use your compiler's debugger so that you can see exactly what is happening.
I just found out on CNN that Old Ironpants has died at age of 87. RIP dear dear lady. No matter what your politics are she made a profound difference in he world.
Well, no one is going to do your homework for you. You have explained the assignment, which part(s) don't you understand?
It moves the file pointer 4 bytes towards the beginning of the file from the current position.
you're going to have to make searchtype public global so that Form2 can read it.
Your professor wrote his/her own version of graphics.h (and associaged library). It's not the same one that is commonly used by Turbo C. Too bad he named it graphics.h because its confusing with Turbo C's graphics.h which most if not all older programmers are familiar with.
Does your professor's graphics.h contain non-standard keyboard handling functions? such as those found in conio.h, which is also non-standard? The standard C keyboard functions can't do what you have in mind because you always have to press <Enter> key afterwards. Better to use getch() from conio.h because it doesn't have that problem. getch() returns immediately, 0 or 224 if a special key was hit such as Function keys, one of the arrow keys, home, end, PgUp, PgDown. When that happens you just call getch() a second time to find out which of those keys was hit.
You might try putting it at line 101, after that if statement
void character_animation()
{
for (int i = 0; i < MAX_LOOPS; i++){
if( ! character[i].draws)
continue;
// wait for keyboard input
while( !_kbhit() )
Sleep(100);
int c = getch();
if( c == 0 || c == 224)
c = -getch(); // make it negative
//Puts image of character on screen based on inputs from struct
Here is a short test program to display key values
#include <conio.h>
#include <iostream>
using std::cout;
int main(int argc, char* argv[])
{
int c;
while(1)
{
c = _getch();
cout << c << '\n';
if( c == 0 …
Many people don't like toch screen on a PC because they hate the finger prints all over the screen. I have Windows 8 on a touch screen PC and I don't really care much for it, a lot easier to just use the mouse. I have another PC with Windows 7 and have no intention of upgrading (or downgrading?) to Windows 8 I'll give another look when Windows 9 is released probably in a couple years.
That compiler doesn't know how to use graphics.h, unless you found a 3d party library that implemented it for 32-bit and/or 64-bit MS-Windows os. graphics.h was used in the 1980s by Turbo C for MS-DOS 16-bit operating system. Pretty nice in it's day, but not useful today.
Of course, you might be talking about a completely different graphics.h. If so, where did it come from because it's not part of VC++ installation.
StarDock is offering a new (reasonably priced) utility called ModernMix which will allow you to run all of the Metro (full screen) apps in windows just like regular desktop apps
Doesn't Windows 8 do that now?
If you're using graphics.h then I suspect you are using Turbo C. That compiler can not use either of the libraries I mentioned because it's too old amd obsolete. I don't know how to help you because it's only been 30 years since I used that compiler.
my original hard coding produced poor performance.
You're not going to get any better performance either. If you want good performance then use a game engine that is designed for that, such as DirectX or OpenGL (there are probably many others too).
what is the question???
beautiful spring day here near St Louis Missouri (USA):)
why does line 8 exist??? You probably need to delete that line. And line 11 is missing open brace {
line 42: need to add a return value, e.g. "return 0"
what part of that don't you understand? What do you need help doing?
I wish I could edit the line of text below my username below my picture at the left side of this post.
Post that request in DaniWeb Community Feedback. Mods and former Mods can do it, maybe those who donate can too I don't know.
On my computer GetWindowsDirectory() returns "c:\windows", not "c:\windows\system32\"; Check the output of GetWindowsDirectory() to see if it is returning what you think it is returning
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
using std::cout;
int main(int argc, char* argv[])
{
char wdir[255] = {0};
GetWindowsDirectory(wdir,sizeof(wdir));
cout << wdir << '\n';
return 0;
}
Is that a compile-time or run-time error? Did the program include windows.h? What compiler are you using?
HP Basic way back in 1982. Their version of BASIC was more like PASCAL today. Programs were stored on 8 1/2 inch round diskettes.
I should think the best way is to have everyone log in when they start the program. If you do that then you can easily expand on your idea to associate certain buttons and stuff by user and/or password. If the user does not have permissions to press a certain button then just hide it after logging into the program.
That's just so much bullshit. Science is leading noone to destruction. If God created everything then it follows that God also created science, and doctors, and dentists, and ... It's a little like the gun issue -- guns don't kill anyone, people kill people. God created science, so what do you expect He thought we should do with the science He created? I see no conflict between belief in God and science. Science is nothing more then our attempt to explain how and why God created all that stuff. Science is just an attempt to explain to ourselves something that has always existed. Nuclear weapons have always existed, since the beginning of time itself, because God created it that way. Man didn't create nuclear weapons, God did.
So you can not say that "science is leading us now to descrition". That's just a ridiculous statement.
don't know what a university topper is. Whatever it is, your wish is granted, but universities don't exist any more. They have been replaced by the Federation Academy.
I wish I had a new Rolls Royce automobile.
You're trying to read everything into the same address space -
Oops! I missed that one.
Looks like it should work. Except you only need "%d" instead of "%03d" because internally integers don't have leading 0's like you see them printed out. If you want to print out the number then use "%03d"
I accidentally added a comment to Up vote before discovering that it should have been aa comment to Flag Bad Post comment. Now I can't delete the comment. Can you do that for me?
I remember getting a 40 meg (huge capacity) hard drive for $800
I bought one of those too. Just recently bought a 3 tb external drive for $120.00. Can I have my $800.00 back now?
My first real computer was a Zenith 100 with 16K ram and two 5 1/4" floppy drives, no hard drive, MS-DOS 1 operating system (folders were not supported then). We had a very fast 300 baud modem that took about 1 1/2 hours to send a 2k text file from one computer to the other. I had a Lattice C compiler on one floppy disk and data on the other. I'd start a compile then read a book for an hour waiting for the compiler to finish. This was all in about 1982.
i have managed to bypass that a couple of times.
Figures :)
You don't need command-line argumnents. Delete lines 24-33 because you don't have a file to open. On line 24 substitute stdin for fp. stdin is always an open file that represents keyboard input and can also be used for redirected files.
reverse(stdin);
when you type ./rev < numbers you are redirecting the contents of numbers into rev program. That is not what rev is expecting. Leave out the < symbol, just ./rev numbers
(assuming numbers if the name of a text file)
Also I can't read a file one per line, and prints them back out in reverse order. I need output like:
A couple ways to solve that problem:
Read the file backwards. This is a little more complicated than reading the file forwards as normal because you have to back up the file pointer before every read.
Keep all the numbers in memory (linked list is good for that) then print them out backwards.
line 34: you have to convert the int to a pointer, just add & operator like this:scanf("%d",&mybook[i].year);
Why did you put all those pointers into the structure? You could have saved yourself a great deal of trouble by not using pointers in the structure. Each structure instance should hold the data for only one ebook. Then you can have an array of structures. For example:
struct ebook {
char title[80];
int edition;
int year;
char author[40];
char publisher[80];
double price;
int page;
};
struce ebook mybooks[2];
Now reading and writing the structure is very simple and accomplished in only one line of code
fwrite(mybooks, sizeof(struct ebook),2,fp);
fread(mybooks, sizeof(struct ebook),2,fp);
If you don't need all the ebooks in memory at the same time then you don't even need the array. Just read/write the structures on at a time inside the loop.
why are you using stringstre3am? It's like hitting a nail with a slughammer.
What is variable n for? Just use the loop counter i.
if( line[i] == ' ')
{
break;
}
else
{
}
that will give you only the first word in the line. What are you going to do with the rest of the words that nave not been processed?
If the columns are always in the order you posted, then after reading a line the data for Tuesday immediately follows the first semicolon. You can locate the position of the first semicolon by calling the function strrchr() (string.h). That function will return a pointer to the first occurrence of the semicolon (or some other character you specify).
beginning of loop
read a line
find position of first semicolon
increment the pointer returned by strrchr() by one to bypass the semicolon
now increment the pointer some more until the first non-space chacracter is reached
The pointer is now at the beginning of the data for Tuesday
Copy the data somewhere else to keep it for later printing or just print it on the screen
end of loop
Depends on the game. But if it is a game you bought that is on DVD then you probably have no choice other than to use the game's installation program. If it's a game you wrote then how you do it is up to you. Most games nowdays that are on dvd are in compressed format to save space and have to be uncompressed in before they can be run. So just simply copying the same to your hard drive will be useless. Many new games also require internet access and Steam client running.
what is the program supposed to do?
All you have to do is call time() function (see time.h) to get current computer system time and date. Then you could have the data stored in files with the filename of the date it was written (you would want to include time if time of day is important). For example the filename could be "2013-3-24.txt" If you want the data for a specific date just format the filename with the given date.
Another way to do it is to have all the data in one file and date/time stamp each record. You didn't mention what kind of data you are talking about, so assume one row if the file for any given date/time. The time could look much like an Excel spreadsheet where columns are separated with commas or some other character.
I had to change all the bitmap code back to chars because I changed them to wchar_t and it read the bitmaps wrong
Yup -- sizeof(wchar_t) is not the same as sizeof(char). UNICODE doesn't have any affect on bitmaps or other types of binary data. It only affects human-readable strings.