15,300 Posted Topics
Re: 1. start a new empty project and call it qcard5. 2. Copy the *.cpp and *.h files from qcard4 into qcard5 directory 3. select menu Project --> Add To Project --> Files and select the files you want to add to the project. Mission accomplished. | |
Re: you can not initialize variables using calculations as shown at the beginning of your program (globals). Variables are initiailized only once when the program starts. If you want the program to do the calculations then you have to do them at the appropriate time, such as set the value of … | |
Re: And [URL="http://www.codeproject.com/dotnet/SettingWallpaperDotNet.asp"]here[/URL] is how to change wallpaper. | |
Re: I'm certain there is a FAQ about this. The only way to do that is to rewrite the entire file. Read the whole file into memory then write it back out the way you want it. If the file is too big to read into memory all at once you … | |
Re: use srand() to see the random number generator [code] int main(){ srand(time(0)); cout << getRand(); cin.ignore(2); } [/code] | |
Re: dev-c++ doesn't like strstream header file and claims it is deprecated. you should consider tossing it out of your program and using either iostream to display stuff on the console window or fstream to read/write to a disk file. | |
Re: >> fwrite (fp,i*sizeof(char),1,buff); there is no need for sizeof(char) because it is guaranteed by the language to always be 1 regardless of platform or compiler. Just makes less typing and fewer characters to read :mrgreen: fwrite (fp,i,1,buff); | |
Re: See [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/ioctlsocket_2.asp"]ioctlsocket[/URL] | |
Re: just a few coding style changes -- I like to make one-line functions inline -- saves keyboard typing :cheesy: [code]// Store creation for practicing Classes in C++ // Woobag float TOTAL_PRICE = 0.0; class cFood { protected: string type; float price; public: void setvalues(string, float) {type = i; price = … | |
Re: [URL="http://www.google.com/search?hl=en&q=how+to+write+a+dll&btnG=Google+Search"]Tutorials[/URL] | |
Re: See Microsoft's [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vctutor98/HTML/_gs_data_access_objects_.28.dao.29_.tutorial.asp"]Enroll Tutorial[/URL] and [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/_sample_mfc_enroll.asp"]here[/URL] for an MFC solution. If you need to use Chinese character sets you can code for UNICODE by defining the macro UNICODE and _UNICODE in the project c++ settings. I don't know how that will affect the MFC database code that is presented in … | |
Re: I think you need a clearer definition of what you want. characters don't just "disappear" -- unless your a magician. Post an example of what you want. For example, if the word "hello" is read, do you want to delete the two 'l's and make it "heo"? | |
Re: If MSData is a c++ class then its destructor should delete all dynamically allocated class objects. | |
Re: implementation is normally in either a *.lib or *.dll and may or may not have the same name as the header file. You will probably not have the source code for system libraries and dlls. normally will NOT have the same name because libraries and DLLs contain implementation for many … | |
Re: what operating system and compiler are you using? Some of the code appears to be MS-Windows 32 api functions, but I don't know what the rest is -- gotoxy() is a TurboC MS-DOS function, there is no such thing for MS-Windows GUI programs. | |
Re: >> int elements[] ={0}; This array only has one elelement and its value is 0 >> while(integer != -1) I'm supprised this loop works at all! variable [b]integer[/b] is unitialized and contains some random value. >> elements[counter]=integer; you can't resize an array like that. If you want to make the … | |
Re: [QUOTE=gampalu]Sorry to be boring but I want to count the number of strings only in the first line. I mean a string each group of one or more caracters limited by a space... Can you help me? I tried to use the code you indicated but without sucess...[/QUOTE] Those are … | |
Re: post code. Since you use fopen() I assume this is a C and not C++. After fopen, just use fprintf() then fclose(). [code] char strp[] = "Hello World"; FILE* fp = fopen("myfile.txt","w"); fprintf(fp,"%s\n",strp); fclose(fp); [/code] | |
Re: >>disp.c:29:9: empty character constant >> if(c<''||c>0x7e) there is no character between the single quotes. you probably meant to put a space there?? Another bug: >>}while(c!=EOF); the above is not needed because its not a do-while loop. | |
Re: Why does that first error not supprise me. :eek: The so-called code you posted in red is not code at all. I have no idea what it is. You can't just type in some crap into the program and expect the compiler to understand it. The only valid error is … | |
Re: download [URL="http://www.programmersheaven.com/zone8/cat121/32947.htm"]this[/URL] brief example program. and look at tic2a.c. It uses non-standard functions but might work with your compiler if you include conio.h. | |
Re: there is no bug in GetTickCount(). The reason it wraps around is that a DWORD can only hold a finite number of milliseconds and it reaches its maximum at 49.7 days. So if your program runs longer than that without being stopped and restarted, then you will have to compensate … | |
Re: [QUOTE=iamthwee]What is this '[I]google[/I]' you talk of? :?:[/QUOTE] Its a search engine for the internet. see [url]www.google.com[/url]. type in a key word(s) and it will try to find it. Sometimes it works ok, but often it will return trillions of answers :mrgreen: | |
Re: create a structure that contains the items for each record in the file. Then either create a linked list or an array of these items and read the file into the structures. You will want to rewrite all this information before the program ends so that the changes will be … | |
Re: there are a lot of errors in that code. For example, in a linked list, the [b]next[/b] item is supposed to point to the next node in the list. [code] start->next >>> node->next >>> node->next ... [/code] The end of the linked list is noted when [b]next[/b] == NULL. Your … | |
Re: [QUOTE=Joncamp]I'm running Apache 3.0, and have a c++ cgi-bin program working fine with Apache... [/QUOTE] Then your program is NOT "running fine with Apache" :cheesy: Did you check the read/write permissions on the directory in which the program is attempting to write? | |
Re: [QUOTE=gampalu]Hi! I built this class, however when I executed my program the memory run out quickly, because I wasn't making any "deletes", so I added the delete in the destructor, but It crashes there... what's wrong? [/QUOTE] Nothing wrong with what you posted -- its impossible to tell what the … | |
Re: in *nix they are [URL="http://www.dwheeler.com/program-library/Program-Library-HOWTO/index.html"]shared libraries[/URL] | |
Re: a matter of correct typcasting. Note placement of asterisks and other typcasts in the scanf() line. I did not run your program so I don't know if it really works right. [code] case 1 : { user_array=(int*)malloc(size_of_input*(sizeof(int))); if (user_array==NULL) { printf("MEM ALLOC FAILED\n"); exit(1); } else { printf("Enter Data to … | |
Re: maybe this will help [code] #define _WIN32_WINNT 0x500 #include <iostream> #include <windows.h> using namespace std; int main() { HWND hWnd = GetConsoleWindow(); ShowWindow(hWnd,SW_MAXIMIZE); cout << "Hello World\n"; cin.get(); return 0; } [/code] | |
Re: maybe [URL="http://support.microsoft.com/?scid=http%3a%2f%2fwww.support.microsoft.com%2fkb%2f309294%2fen-us%2f"]this[/URL] will help. But this will be a great deal easier if you learn to use VB.NET -- you can mix and match VC++.net and VB.net functions. | |
Re: your program works ok with my compiler (VC++ 6.0). what compiler and os are you using. did you include stdio.h header file? And after changing the value of the "a" variable don't forget to recompile your program. | |
Re: I think what you will probably want to do is remove the word(s) from the strings. If you use c++ and std::string, use string's find method to locate the word then use its substring method to remove it. | |
Re: The functions FindFirstFile() and FindNextFile() will iterate the all the files and sub-directories. For each file they return a structure that contains the filename, attributes, size and other data. Check the file's attributes to see that it is a normal file and, if it is, your program can open and … | |
Re: Sorry, but I don't think you can write a c++ program to fix that problem.:mrgreen: | |
Re: you probably should post your question on adobe's "user to user" forum. | |
Re: [QUOTE=sunnypalsingh]Why are you casting [b]strlen[/b]. There's no need for that.[/QUOTE] there is if you use vc++ 2005 -- strlen() returns size_t (unsigned int) with that compiler. | |
Re: If you are compiling a C program as C++ (with .cpp extension instead of .c extention), then you will have to typecase malloc because the compiler is compiling it as a c++ program, and c++ requires the typecase. If, on the otherhand, the file is *.c extension, then no typecase … | |
Re: use a vector if you want an array of strings. [code] #include <string> #include <vector> using namespace std; int main() { vector<string> array(5); // initialize to be an array of 5 strings switch(z) { case 0: array[0] = "entry 1"; array[1] = "entry 2"; ... } } [/code] | |
Re: you need to make the linked list global so that it is visible to all other functions. | |
Re: This looks like it should be a linked list of messages. You need to allocate an object that represents the head of the linked list, then add nodes to it. One way might be like this [code] void sqEnqueue(struct Message_from_server** head, const char *s) { struct Message_from_server* new_node = malloc(sizeof(struct … | |
Re: [URL="http://www.microsoft.com/downloads/Browse.aspx?displaylang=en&categoryid=2"]DirectX[/URL] for MS-Windows os. is free, and includes some examples. Definitely not for beginners. | |
Re: post code. We are not mind readers you know.:mrgreen: | |
Re: use ODBC calls to connect to databases. See google for lots of examples and a few c++ classes. But you cannot do that at all with Turbo C because that compiler is too old, you will have to upgrade to a new compiler like Borland Builder, Dev-C++, or Microsoft VC++ … | |
Re: All the programs I write are MFC programs. Why? Because they can be written in less than 1/4 the time as pure win32 api programs. And you are not limited to just MFC -- you can mix and match as needed with win32 functions. On the negative side, MFC makes … | |
Re: hint: look for function Sleep() which uses milliseconds. And 100 is about as accurate as it can get, depending on what other processes are running on the computer. | |
Re: my quick test using VC++ 2005 Pro shows that cout is faster than printf [code] #include <cstdio> #include <ctime> #include <fstream> #include <iostream> using namespace std; int foo1() { clock_t t1,t2; t1 = clock(); for(int i = 0; i < 100000; i++) printf("Hello World\n"); t2 = clock(); return t2 - … | |
Re: Do you mean the address contained in the pointer or the object to which it points. What kind of pointer do you have in mind? Writing the address to a file is useless because it cannot be simply read back in later and expect it to point to the same … | |
Re: [QUOTE=Narue] But for portability reasons, you can't assume more than -32,767 to +32,767. [/QUOTE] Use the limits in limits.h if you want portability. |
The End.