15,300 Posted Topics
Re: if you are using MS-Windows, create a shortcut then change the shortcut's icon. | |
Re: RW[h] is just the h'th character in the array -- strcpy wants a pointer to a character array. make a character pointer as shown below -- assuming h is the index into the array where you want to copy the string. [code] strcpy([color=red]&[/color]RW[h],"if"); [/code] | |
Re: The second option (with pointer) will be most efficient and fastest because the first option makes a copy of the object before putting it into the vector while the second one does not. And depending on the contents of class C the first option can be very very slow. The … | |
Re: yes. use a while loop and iterate through the array until the desired value is found or the loop counter reaches the maximum value of the array. | |
Re: [QUOTE=michika]hi.. just want to ask if <fstream> is really needed in making a program for round robin scheduler? im currently taking my os class and our project is to make a code for RR.. :?:[/QUOTE] fstream is not needed unless you want to save the data to a file on … | |
Re: what errors are you getting? I see a couple of missing semicolons -- your compiler should complain about them. Look at the errors, then look at your code and see if you can figure out what's wrong. | |
Re: Since you want to spend your money, buy Pro edition. The Express is FREE -- you can't buy it. | |
Re: you can't access most databases, such as Microsoft Access, SQL Server, MySql, Orical, etc, with that old 16-bit Turbo C compiler. You will have to upgrade to a modern 32-bit compiler, such as Dev-C++. Then you have several options, the oldest is ODBC. google for ODBC and you will find … | |
Re: Depends on operating system. If you are using MS-Windows, you can use win32 api function CopyFile() -- see MSDN for details. To my limited knowledge of *nix, I don't think *nix compilers have a similary function. You might also check the Boost libraries to see if it has a portable … ![]() | |
Re: [QUOTE=sunnypalsingh]A [b]string[/b] is any finite sequence of characters (i.e., letters, numerals, symbols and punctuation marks).[/QUOTE] There are two types of strings -- C and C++. A c-style string is a [b]null-terminated[/b] sequence of characters -- certainly considerably less than infinite! That means that the string ends with the first byte … | |
Re: did you delete the debug and/or release directories before you zipped of those files? And what compiler/version did you use? | |
Re: [QUOTE=chaitanya.b] swap the string with out using any library functions [/QUOTE] you will have to 1. create a temporary buffer large enough to hold the longest string. 2. write your own strcpy() function -- but name it something else to avoid confusion with standard C function. 3. Then use the … | |
Re: you can't contantinate C style character arrays like that. Create a third buffer that is _MAX_PATH bytes long (if you are using MS-Windows os, I don't know what it is on *nix), then use sprintf() to create the string. Remember the format string uses "%s" for strings and "%d" for … | |
Re: >>return (a + b + c) / 2; should divide by 3, not 2. I see no ambiguity in the average template -- all parameters are of type T and the caller cannot pass the first as int, the second as float and the third as double. All three must … | |
Re: now create the switch statement -- its easier than an if-then-else statement [code] switch(num) { case 1: cout << "one" << endl; break; case 2: // you can figure out the rest } [/code] | |
Re: you don't need strcpy() at all [code] char sendBuffer[5]; char ch; // assume code in between makes ch something sendBuff[0] = ch; sendBuff[1] = 0; [/code] | |
Re: Wolfpack's program works ok with Dev-C++ too. I have version 4.9.9.2, but some previous versions should work too. | |
Re: use qsort, std::sort(), or some other sort algorithm to sort the array normally then just print the values out in the desired order. | |
Re: no, but [URL=http://www.google.com/search?hl=en&q=how+to+convert+int+to+binary+in+C&btnG=Google+Search]Google[/URL] is a good place to find out how to do it. :D | |
Re: [QUOTE=atrusmre]Is there a way to make a MFC application have Network capibilities without using windows sockets? [/QUOTE] No. winsock is Microsoft's implementation of Berkley Sockets which is the standard socket library in *nix os. | |
Re: look in the CDocument-derived class for your project -- it contains a skelletin of Serialize() function that you have to compilete (make it actually do something useful). This is where you read/write the data that you want saved to a file, database, socket connection, or anywhere you wish. | |
Re: ThreadMessages() must be a static method of the c++ class or a global function outside any class. I prefer using CreateThread() because it does not require linking to special multi-threading libraries like _beginthread(). | |
Re: you can use strtok() -- warning, that function changes the string, so if you need the original string later in the program you will have to make a copy of it before calling strtok() the first time. [code] std::string str = "48098, 50933, 3128, 323, 42, 5"; int n; char* … | |
Re: you might have some other problem. This works ok for me [code] #include <iostream> using namespace std; void foo(const long& l) { cout << l << endl; } void foo(const bool& l) { cout << l << endl; } int main(int argc, char* argv[]) { bool b = true; foo(b); … | |
Re: [quote]what modifications shd i do[/quote] A complete (or nearly complete) rewrite. There could be a port of graphics.h to win32, but I have't heard of any. google around a little to see what you can find there. | |
Re: This is normal c++ stuff and has nothing at all to do with MFC, other than MFC is also c++. When you put static keyword in the .h file that is making it global with the namespace of the class in which it is defined. So your compiler is producing … | |
Re: since you didn't post any code we can only guess. sysName is apparently NOT declared in any of the header files that are included in server.cpp. user the extern keyword like below. [code] // includes.h [b]extern [/b] char sysName[32]; [/code] | |
Re: [URL=http://www.codeguru.com/forum/showthread.php?t=317174&highlight=round+float]Here[/URL] is another way to round (maybe) the internal representation of a float. | |
Re: make the column number a variable so that you can change it as desired. [code] int col = 7; for(int i = 0; i < col; i++) [/code] | |
Re: yes -- [code] vector<string> names; // // assumes there are more than 4 names in the vector sort(names.begin()+1, names.end()-2); [/code] | |
Re: API (Application Program Inerface) allows your program to access operating system functions, or functions in a library that may have been written by someone else. For example, the functions sleep(1000), a *nix API function, and Sleep(1000), a MS-Windows function (note spelling capatilization differences). They may be implemented in either a … | |
Re: please edit your post and enclose the code in code tags. I hope the original program contains proper indentations so you can read it. [ code ] // code here [ /code ] remove spaces from above. | |
Re: Those are non-standard C functions that are defined in conio.h. Because they are non-standard, they may not be supported by all compilers (I think Dev-C++ supports them) | |
Re: might be your compiler -- mine (VC++ 6.0) prints -133. what compiler are you using? | |
Re: it does nothing because the function is never called anywhere. And why not use std::string for the file names instead of C style character arrays? If you are writing c++ then use c++ as much as possible. And you should use getline() for entering filenames so that the path and … | |
Re: I would probably make a duplicate copy of the string, convert it to all upper (or lower) case. Then instead of using the Replace method you show, find the position of the first occurrence of "<BR>" then replace it in both copies of the string. I don't have enough experience … | |
Re: saying something is part of the standard c++ library doesn't mean it is declared in <stdlib> -- and there is no such header file. you probably mean <cstdlib>, which was derived form C language. getline() is a method of std::string class and (I think) iostream. [code] #include <iostream> #include <string> … | |
Re: first you need to declare an array of integers that represent the count for each characters -- since there are 26 letters in the English alphabet ('a' - 'z]) you will need an array of 26 integers. [code] int counters[26] = {0}; [/code] The abover declared the array and initialized … | |
Re: rewind() does nothing more than seek to the beginnng of file. In C you can accomplish the same thing with fseek() function. In C++ fstream use seekg(0,ios_base::beg) or seekp(0,ios_base::beg) | |
Re: yes, it can be similated in C with structures. Its not [b]quite[/b] the same concept as inherentence, but pretty close. And c++ class methods are not tied to any specific instance of a class -- they are more like static c++ methods. [code] struct Lightwave { // blabla } struct … | |
Re: It is not necessary to actually store the data in a vector or some other array. Just keep track of the min and max values as the data is read from the file. | |
Re: [QUOTE=gmv]Hi, Thank you very much for your reply. i did use Sleep(20) but it doens't seem to work. Is there a wrong or a right way to do it? i am also wondering if the sleep fnc c? gmv[/QUOTE] What makes you think it doesn't work? 20 milliseconds is not … | |
Re: why didn't you answer it? Its not that difficult. If you know what today is, then just use sprintf() to format the filename [code] int day_of_month = 10; char filename[255]; sprintf(filename,"day_%02d.txt", day_of_month); [/code] | |
Re: you can use that macro anywhere you use a string literal. You can't, however, use that macro with a char* [code] // this will NOT work char* hello = "Hello World"; wchar_t thello = UNICODE(hello); [/code] | |
Re: can't help you at all if you don't post the code you created. | |
Re: if the file isn't too big, stat() will return its size, among other file info. you don't have to open the file to use it. | |
Re: I don't know about CreateRemoteThread -- never used it. you probably won't find any "tutorials" because there isn't that much to it. Most of the parameters are 0, unless you want more control over the thread. First create the thread itself -- name it anything you want. If it is … |
The End.