You have to allocate memory for the string because GetDlgItemText() does not do that for you.
char text[255] = {0};
GetDlgItemText(hwndqw2, IDC_ANSQW, text, sizeof(text));
You have to allocate memory for the string because GetDlgItemText() does not do that for you.
char text[255] = {0};
GetDlgItemText(hwndqw2, IDC_ANSQW, text, sizeof(text));
There isn't a forum for it because no one has ever asked a question about it and the likelyhood that Dani will create another forum for it is very very remote. Post such a question in "Legacy and Other Languages" forum.
what operating system ?
hi to all..
I'm into digital recording.. collaboration..? querys on music production.? just drop me a quick message antytime..
cheers to all!
-Pierre
I have zero musical talent, but welcome to DaniWeb anyway :)
Just how big is your bank account anyway? Did you take your own silly advice?
While yes one can remove any personal info from their profile and simply choose never to re-enter the site, there's still the publicly available record of everything they ever posted. The simple fact is, FaceBook has provided the perfect example (and this is not the only example, but serves the point) of how that really can be abused, such as by employers both filtering candidates, or monitoring the attitudes of present employees.
Even if the username was deleted the posts would not be. Deleting those posts would probably destroy the continuity of all the threads in which that member posted. And that wound render all those posts next to useless to anyone.
>>In release mode, nothing happens.
Because asserts are only shown when compiled for debug mode. The same problem exists, its just that the assert does nothing when compiled for release.
My guess is that the program has corrupted memory while reading the file or converting to the dialog.
Another reason for soft deletes is so that the mod (or SuperMod, or other Admin) can reverse the decision to delete the thread. If it were a hard delete then there it can not be undeleted. Mods are human too and sometimes make the wrong decisions.
what difference does it make whether you know the rules/regulations or not? If Dani wants to keep accounts forever, what difference does it make? You can always go into your CONTROL PANEL and delete any personal information that you may have posted there. If someone wants an account deleted then just simply stop posting or visiting DaniWeb.
static methods can not call or use non-static methods/data. static methods behave more like non-class functions, which also can not directly access class objects.
you can not make non-static class methods callback functions. Make the method static and it should work.
Because doctor_hour_fee is not static. And if you declare a member variable static you must initialize it in a .cpp file before using it.
This is a function, not a data object.
And you are right about static. Put the static keyword in the class declaration, not in the implementation code.
class Doctor
{
public:
static float get_fee_of_doc();
};
Here is an example : Called by address.
void change1(A** source, A** destination) { *destination = *source; } .... change1(&ob1, &ob2); // called (passed) by address
That may or may not be the correct solution, depending on whether he wants to copy the address of the two objects (set the two addresses to be the same) or copy the class and leave the addresses unchanged.
If he wants to copy the addresses as your function does then he needs to delete the allocation for the destination parameter because your function will cause a memory leak.
replace those tabs with setw() as shown in previous post. If you want the text left-justified (meaning, padded with spaces on the right side of the text) then also add left]/b]
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
cout << left << setw(10) << "Hello"
<< left << setw(8) << "World\n";
}
It doesn't work for the same reason that the change function doesn't work. *ob1 = *ob2;
When you write ob1 = ob2
all that is doing is setting the address of ob1 to be the same as the address of ob2. You have to add the star to copy the object.
Next time use code tags.
The two streams are local to Open_Files()
function, so they are immediately closed as soon as that function terminates. What you want to do is pass the stream by reference as parameters to that functionvoid Open_Files(ifstream& inFile, ofstream& outFile)
The similar fix for Close_Files()
function. And the function you posted is 100% wrong.
void Close_Files(ifstream& inFile, ofstream& outFile)
{
inFile.close();
inFile.clear();
outFile.close();
outFile.clear();
}
Now down in main()
you have to add parameters to the above two functions.
First you have to know what kind of data is arriving at the port. Then just add the characters to a data buffer. I have no idea what data you are getting, so just assume you want to put it into a character array
unsigned char buffer[255] = {0};
int nextin = 0; // next spot to add a new charcter
void ProcessChar(unsigned char c)
{
if( nextin < sizeof(buffer)) // make sure there's room for the char
buffer[nextin++] = c;
}
void change(A* source, A* destination)
{
destination = source;
}
That doesn't do what its supposed to do. All it is doing is swapping pointer addresses and not the objects to which they point. Therefore that function is useless.
This is the correction: (Note: you may have to write a copy constructor for the class)
void change(A* source, A* destination)
{
*destination = *source;
}
Just try to open it -- if open files then its probably already opened (assuming COM1 exists and there are no hardware problems)
If there is only one doctor, then you can make get_fee_of_doc() a static method so that it can be called from anywhere.
>>Doctor::get_fee_of_doc
That doesn't work because get_fee_of_doc() is not a static method. How does the patient class know who his doctor is?
in Patient class you need an instance of (or better yet a pointer to an instance of) Doctor class. And in the doctor class I presume you will want a list or vector of patient classes.
In Code::Blocks IDE, select menu item Settings --> Compiler and Debugger. Click the Linker Settings tab. Then click the Add button and enter the name of the library.
Instead of waiting for someone to answer you why don't you try browsing around your compiler's IDE options. Look for something like Linker options, and Additional Library Dependencies. It won't be those words but something similar.
you have a *nix port of g++ compiler. So it uses *.a. Look in your <compiler's install directory>\lib
There are two ways to link: 1) static link, which normally does not require the DLL so the code is inside your .exe file, and 2) dynamic link, where the *.lib file only contains enough information for the linker to resolve references, and your program will need access to the DLL at runtime. There advantages and disadvantages to both link types. I normally do the dynamic link to keep the size of the *.exe as small as possible.
BTY: for your compiler you should have a library with *.a extension, not *.lib.
you use it the same way that you use any other standard library. Take time.h for example. That header file contains function prototypes for functions such as time(). Then all you do is call time(), passing the appropriate parameter. When you compile the program the compiler will link with the standard library that contains the source code for the time function.
You do that too. If you have a header file for that dll then include it in your program. If not, then just add the function prototypes to the top of your program, after all other include statements. Then all you have to do is call the function just like you would have called time() in the above example.
You have to tell your compiler the name of the *.lib file. I don't have Code::Blocks installed so I can't tell you how to do that, but I'm sure it should be fairly easy to find out by browsing around the program's project options.
Your program is already using several .lib files from the standard C and C++ libraries. If its a dll that you write and compiled, then most likely your compiler generated a lib file. If its a dll that someone else write/compiled then you might be able to get the *.lib file from whoever wrote it. AFAIK its not possible to generate a lib file from just the DLL.
First problem:
int main()
{
string h = "abcde";
std::reverse(h.begin(), h.end());
The problem with the second function is that the parameter is passed by value instead of by reference.
most likely you need to use stringstream class
#include <sstream>
...
...
istream& operator>> (istream& in,Format& b)
{
//cout<<"enter's format";
string word;
string line;
char just;
size_t count=0;
getline( in, line);
stringstream str(line);
while( str >> word )
{
b.add_word(word);
count++;
}
// Not sure about the following
//
cout<<"what justification would you like?"
<<"pick from 'l','r','c'\n";
in>>just;
//cout<<"the value is"<<just<<"\n";
//b.setJustification(just);
in.unget();
for(size_t i=0; i<count; i++)
{
b.add_justif(just);
}
//count=0;
//cout<<"all the words are"<<b;
return in;
}
ancient dragon ... if you would remember where you found the information that helped you or have any idea where i should try to look for these tutorials
I started learning C in 1980(?), long before the internet existed as it does today. I bought a textbook, cheap computer (at that time from Radio Shack) and started reading.
Here are a few good tutorials. Although I have not read them thoroughly, these look to be very good, and geared to beginners who know absolutely nothing about programming.
>>while (clocks() < endTurn){}
misspelled. clock() instead of clocks()
you could use
while(!dict.eof())//this will make it keep going untill the end of line { dict.getline(words,sizeof(dict));//this will read line by line }
hope it helps
Not really -- that loop will cause the last line to be inserted into the array twice.
>>,sizeof(dict)
You mean sizeof(word), assuming word is a character array instead of std::string.
line 14: where is max declared? Note that max is not the same as MAX.
You should use a <vector> instead of string array for two purposes: 1) avoid unnecessary memory allocation, 2) avoid possibility of array overflow (adding too many strings). The <vector> or <list> class will take care of both those problems for you.
You didn't post the entire program, so I assume you failed to include the header file that declared clock() function.
>>I would have suggested to myself to re-learn everything online.
But you get a lot of old information, or just plain mis-information that way. IMHO the best method is to buy a good c++ book. I realize 16-year-olds may not be able to afford the price, so get a job and save up for it, or borrow the money from your parents (or grandparents).
Hi,
I didn't get what you pointed out there. Can you please type the statements so i can give it a try.Many thanks,
Please read what you yourself posted.
In order to delete lines you have to completly rewrite the file, omitting the lines you want to delete
1. open the input file for reading
2. open a temp file for writing
3. start a loop that reads a line from input file. If it is not one of the lines to be deleted then write it out to the output file.
4. After the loop finishes, close both files.
5. Delete the original file
6. rename the temp file to the name of the original file.
Start by reading this thread. Buy yourself one of the good books mentioned in that thread and start studying form page #1. You can also find lots of tutorials on the net that will get yourself started.
>>I don't think any of the windows compilers ship with unistd.h do they?
cygwin has it and all the other *nix header files. That can be configured with g++ and Code::Blocks. The Microsoft compilers do not support it.
OMG! Only 16!:icon_eek: Computers had not even been invented yet when I was your age -- I was more interested in girls.
Anyway -- glad you are here ;)
In a loop just use the mod operator to switch between upper and lower case
int main()
{
char str[] = "Hello World";
int i;
for(i = 0; str[i] != 0; i++)
{
if( (i % 2) == 0)
str[i] = tolower(str[i]);
else
str[i] = toupper(str[i]);
}
printf("%s\n", str);
}
The system() function does not accept but one string parameter, so you have to make the command all one big string.
string command;
command = "TASKKILL " + cProcess + "/t"; // or something like that
system(command.c_str());
Sane has posted many problems that you can work on. Link here See especially his Monthly Algorithms Challenges
The line with sprintf() should have formatted the filename correctly. Why do you think it didn't?
>>Please provide me the solution
The solution is to trash that compiler and get a modern one that is compatible with current Windows operating systems. VC++ 2008 Express and Code::Blocks are both good choices. Google for them and you will easily find the links.
Trash that compiler and get a modern one such as VC++ 2008 Express or Code::Blocks. Both are good choices.
google for bubblesort and you will get the code you want.
That compiler can not compile 64-bit programs. Either buy the Pro edition or use g++.
Curses! I forgot about the 2GB 32-bit limitation. I don't suppose there is any simple way to reconfigure my compiler (Microsoft Visual C++ 2008 Express Edition) to compile this code in 64-bit mode and thus enable it to access the necessary RAM? Would I have to re-write the code?
You can not configure the Express edition to do that. You will have to buy a pro edition (or maybe standard). You also might want to check out GNU g++ because I think it will compile 64-bit programs.