line 31: num<=num
That makes an infinite loop because num will always be equal to itself.
line 31: num<=num
That makes an infinite loop because num will always be equal to itself.
Oh yes, I know how that goes. You can close the thread youself by marking it Solved.
Can you be more specific? What events? How is the ActiveX control written (MFC, ATL, or something else (what))? If the callback function is a member of a class then it must be a static method, otherwise it must be a global function.
why are you using an online compiler? There are several free compilers that you can download and compile on your computer, assuming you are using your own computer instead of one located in some public place like a library or at school.
line 59: notice the pointer is local to the constructor. As soon as the constructor ends the pointer goes away and all memory alloted to it is lost (memory leak).
Correct the problem by allocating memory for the pointer that is declared in the class, like this:this->Participants = new Participator*[size];
remove ///\\ and see if that removes the warning
lines 106, 108 and 109: fprintf() is missing the first parameter FILE*, see line 97 for correct syntax.
You need to pass a pointer to the struct declared in main(), not the struct itself. Since you declared students as an array of structs you have to tell ypologismoi() which one it needs. For example:
ypologismoi(inArxeio,&students[0],&p100,&pAll);
If your intent is to pass the entire array, then change the function signature
void ypologismoi(FILE *inArxeio,telikaT students[],int *p100,int *pAll)
The error message is incorrect, program is unable to open pwsparam.dat not notes.ini
Are you logged into the computer with Admin permission? You can check the permissions with Windows File Explorer. Post your Notes.ini file so I have something to work with.
I changed my response above. I got the same error because the file does not exist.
Your compiler has a great debugger. Single step through the program so that you can easily see what's going on. My guess is that the input file doesn't exist. Also check permissions on the folder to see if you have read permissions.
what compiler are you using? It won't compile with VC++ 2012 because some of the constructs are just too ancient, such as this one
void message(s1,s2)
char *s1, *s2;
{
fprintf(errfile,"%s %s\n",s1,s2);
}
post the code that demonstrates the problem. I wouldn't think reading from any folder, just writing.
Oops!
It supports other languages too. But if you are using C++, which compiler and version of the compiler? Which version of CE? Are you writing MFC or something else?
Most c++ compilers for CE support FILE*, and some newer compilers also have limited support for fstream class. The last I knew CE did not support the concept of a working directory, so _chdir() is not supported.
What programming language are you writing the program?
In the program that is in separate files you have to prototype the thee functions that return doubles because the compiler doesn't know what they return and assume they return an int, which is not correct.
Put the three prototypes before main()
double hamCalc(double,double);
Can you either post the entire program, or PM it to me so that I can test it?
A couple things incorrect.
Open the files only in the functions in which they are used, then close them before leaving that function. Don't open the files in main() because main() doesn't need them. When you do that you will have to delete the first parameter to both insert() and getinput().
In getinput(), make a check to insure the file was opened for writing successfully. If the file doesn't exist the loop in the function will become an infinite loop. So call is_open() before starting to read the file.
Also, don't use eof() because it will cause the last line of the file to be read twice, instead use this:
void GetInput (telephone data[], int& count)
{
ifstream fin;
fin.open("data.txt");
if( fin.is_open())
{
while (fin.getline (data[count].firstname, 15, ' '))
{
fin.getline (data[count].lastname, 15, ',');
fin.getline (data[count].address, 30, ',');
fin.getline (data[count].cell, 15, ',');
fin.getline (data[count].landline, 15, '\n');
count++;
}
}
}
post the complete program
put some print statements in the functions so that you can see what they are calculating. OR learn to use your compiler's debugger.
The file was already opened by fin.open that was creating problem.
No, that was not the problem.
Open fout like this: fout.open("data.txt", ios::app);
should be ios::ape, not ios::ate
Your account balance is unlimited negative value. You have been arrested for bank fraud because you can' possibly pay back all that money.
You are dead.
You are instantly teleported to the moon where you can perform all the magic you want.
Your question doesn't make any sense. The variables you declared on line 8 have a value of whatever happened to be at the memory addresses, it could be 0 but it could also be any random value. That's not a bad thing because the program changes the values by calling scanf(). My only suggestion here is to use "%lf" instead of "%f" because %f if for floats and %lf for doubles.
lines 52 and 58 attempt to declare variables with the same name. Variable names must be unique.
Yes, but the output file isn't opened. All you opened was the input file. You need to call fout.open() similar to what you did with fin.open(), except you have to add another parameter so that open() won't destroy the file's contents. See the description here for the values of the second parameter.
example: fout.open("data.txt", ios::ate);
<<< Open the file for Appending
line 36: You're attempting to input a c++ class. > operator must be used on a POD (Plain Old Data) type such as an int, float, double, std::string or char*, unless you override the > operator, which you have not done.
line 22: You didn't specify a data type of the array. Should read PlayerInfo players[20]
lines 23, 24 and 25. Delete these lines, you don't need those arrays. The array declared on line 22 contains all that information so there's no need to declare separate arrays for them.
line 34: you need to initialize variable i, e.g. for(i = 0; ...
line 36: This should be like this: inputFile >> players[i].playerid >> players[i].firstname >> players[i].lastname;
notice that you didn't open the output file.
post the line that opens the output file. Also, you need to put a separator after each line 21-25 so that those lines can be read back into the program. For example:
fout << readData[n].firstname << ' ' << readData[n].lastname << ' ' << readData[n].address << ',' << readData[n].cell << ' ' << readData[n].landline << '\n';
You can do one of two ways:
1. Completely rewrite the file adding the new record in any order.
2. Open the file for appending and write it to the end of the file. This is probably the better of the two options.
Davy: Here's a great tattoo artist who is currently on reality tv show Ink Masters. There's only two weeks left this season and I suspect she may win.
Now, my first question is, do I try and run the 'burger.c' file or do i compile the created 'burger.o' file because when I try the .o file it says 'cannot execute binary file'.
you don't do either. You can only run the executable. Add the -o filename to the gcc line. If -o is missing gcc will default the filename to a.out So in your example run ./a.out
It is skipping the line that calls getline() because you are mixing formatted and unformatted data input. When someone enters something he/she always presses the <Enter> key. cin>> does not extract it from the keyboard buffer, so when getline() is called it thinks its the end of data input.
To solve the problem you have to remove all keystrokes from the keyboard input buffer before calling getline() after using >> operator. N ote the use of your getline() was also incorrect. See correction below.
#include <limits>
...
...
cout<<"Enter Last name"<<endl;
cin>>readData[n].lastname;
cin.ignore( numeric_limits <streamsize> ::max(), '\n' ); // empty the keyboard buffer
cout<<"Enter Address"<<endl;
cin.getline(readData[n].address, sizeof(readData[n].address));
cout<<"Enter Cell number"<<endl;
cin>>readData[n].cell;
Did you compile the program? Are there any compiler errors? If yes, then list a few of them. If not, did you try to run the program? Does the program produce the correct results?
In the USA since 1995 colors have trademark protection according the rhe USSC (United States Supreme Court) (click here). Trademarks are different from patents and copyright.
Yes I could, but I won't. We don't do people's homework for them. Instead, you give it a try, post the code you have written, then ask questions about what you don't undestand.
There is a time limit, after that you can't edit the post. Just add another post to explain the correction.
What you want is the win32 api function SHGetSpecialFolderPath(). This function is used to get path to several different operating system-dependent paths. For example if you want the path to "c:\Program Files(86)". The macro in the 3d parameter is defined in this list.
char path[MAX_PATH];
SHGetSpecialFolderPath(
0,
path,
CSIDL_PROGRAM_FILESX86,
FALSE );
For versions Vista or newer you may want to call SHGetKnownFolderPath() instead of the above.
64-bit version of MS-Windows always have both c:\Progrm Files and C:\Program Files(x86), so your program must know which one it wants. There is no win32 api function that will return the path to just one or the other of the folders.
The Rock -- excellent movie with a lot of top-dollar actors.
I don't have much rep power so it doesn't make a huge difference
He didn't have any either, so your vots more than counteract his.
So I guess you're also making an MFC program? You should check out CodeProject.com for the largest repository of MFC/VC++ programs on the internet, all programs/tutorials are free for downloading.
There are several MFC tutorials (click here) you should read since you are probably new to MFC programming.
Since when did Microsoft ever invent anything original?
What compiler and os are you using? Are you using MFC (Microsoft Foundation Class), Windows Forms, or some other GUI (tell us which one)?
maybe there is a space after the second / in the last line. Leave off looking for '\0' and just check the first two characters.
First use ifstream object to open the file for reading.
In a loop use ifstream's >> operator to read the data into each variable
That's the best advice I can give you since you failed to tell us anything at all about what you have done so far to solve the problem.
Purle is ok, it just needs a scattering of pink polka dots :)
you can only assign someTime to a variable that is of the same type as someTime. Look at the structure and figure out which member can be assigned someTime.