15,300 Posted Topics
Re: line 383: copying 1 too many bytes because currentSizeOfS has already been incremented by 1 to account for the null terminator. line 400: The [b]s[/b] pointer was passed by value, nor by reference, so allocation additional memory here only has scope in this function, not the calling function. Just delete … | |
![]() | Re: [edit]^^^ beat me to it:) [/edit] >>fscanf(inFile, "%s", text) >>printf("%s\n", text); I don't know why the file doesn't open, but the above line is guarenteed to crash. Why? Because "%s" tells scanf() and printf() the next argument (text) is a null-terminated character array, and all you passed is a single … |
Re: configuration files are just plain-ordinary text files, so just use ifstream to read them. There are several ways to format the file, one way is in the form [icode]<variable name> = <value>[/icode]. For example: [code] UserName=John Password=xxxyyy Age=18 Address=101 Any Street City=Anytown State=Illinois Country=USA [/code] The list of items in … | |
Re: Try a slightly different algorithm [code] void voorkomentellen ( vector<int> getallen , vector<int>& getelde_rij, vector<int>& voorkomen ) { unsigned int i, teller; int getal1, getal2, count=1; getal1 = getallen[0]; for (i = 1; i < getallen.size( ); i++) { getal2 = getallen[i]; if (getal1 == getal2) { count++; } else … | |
Re: iomanip.h is c++, not c, so you should delete that line (line #4) | |
Re: In c++ you could use the [URL="http://www.cplusplus.com/reference/iostream/fstream/"]fstream functions[/URL] | |
Re: If you want any responoses you need to state the compiler and operating system you are working with. | |
Re: why do you think that function is part of stl library? | |
Re: There are several ways to do it. One way is to use c++ stringstream class. And don't use printf() in c++ programs, it will work, but iostream is more suited to c++. [code] #include <sstring> // stringstream class int main() { int x; string y = "1234567890"; stringstream str(y); str … | |
Re: I would have thought it wise to have read the chapter before doing the extercises at the end of the chapter :) | |
Re: According to [URL="http://www.apples4theteacher.com/holidays/chinese-new-year/when-is-chinese-new-year.html"]this[/URL], you are right :) | |
Re: Happy New Year everyone :) I didn't bother to stay up that late -- went to sleep at 9:45 pm because I have to be at work bright and early this morning. | |
Re: I know many people mistakenly believe evolution is a fact while its actually nothing more than just a good (ok very good) theory. There is no way to prove evolution, just as there is no way to prove creationism. We can believe all we want but that doesn't make it … | |
Re: As you probably already guessed, you don't do that with a bunch of if statements. I guess you already have a list of books with their titles and call numbers, maybe other information too. In that case, all you have to do is code a loop that searches the list … | |
Re: OMG that must be incredibly sloooooow -- calling seek for each character! A much quicker, and more reliable, solution would be something like this: [code] unsigned char inData; while( FileHandlerFile.read((char *)&inData,1) ) DataHexArray.push_back(inData); [/code] | |
Re: >>most urgent Maybe for you, but not for us. Describe the problem you have because we are not interested in just looking at your code and try to read your mind. And next time try to be a little more creative in the title of your threads. [edit]Merged your two … | |
Re: cout<<[color=red]fixed << [/color]setprecision(50)<<"i is : "<<i< ... Don't be supprised when it displays this: [quote] i is : 100 fact is : 933262154439440900000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000.00000000000000000000000000000000000000000000000000 [/quote] | |
Re: >> almsot forgot on how to code in C or C++ you need to refresh your memory before continuing or you will get nowhere very fast. Dig out those old text books you bought (you DID keep them didn't you?) and do a few of the end-of-chapter examples. I have … | |
In case you have not heard yet, the Illinois governor was arrested today for attempting to sell the state's senate seat that Mr. Obama held to the hightest bidder. I'm supprised he didn't try to sell it on eBay. That isn't the end of it -- he was thinking of … | |
Re: Assert is only one debugging tool, and does nothing if you compile the program for release instead of debug. Exception handling works in both debug and release compiles, asserts do not. | |
Re: I have not actually worked with file mapping, but I suspect the problem is that std::string attempts to allocate memory which causes the file mapping to crash. Try replacing [icode]std::string strData[ 200 ];[/icode] with character arrays [icode]char strData[200][255][/icode] and see if that fixes the problem. | |
Re: I'm not completely certain what you are attempting to do, but here is one way to do it. It is not necessary to close the file and reopen it. Just reset the stream back to the beginning of the file, as shown below. [code] std::string line; for( ;; ) // … | |
Re: In VC++ 2008 UNICODE is turned on by default :( . AFAIK there is no way to change this default behavior when creating a project. I always have to turn it off as ArkM posted. | |
Re: warning c4996 -- Microsoft has declared many of the standard C functions from stdstring.h decpreciated (obsolete). The c and c++ standards say otherwise. So you have a choice: 1) ignore the warnings, they can be disabled with this pragma: [icode]#pragma warning(disable: 4996)[/icode], or 2) fix the problems by using Microsofts … | |
Re: [URL="http://www.winprog.org/tutorial/"]MS-Windows tutorial[/URL]. You need a fundamental knowledge of the C language, c++ will work too, but not required. | |
Re: Welcome to DaniWeb. I'm sure there are lots of people here eager to help you. Just post your questions in the appropriate board. | |
Re: [QUOTE=Salem;761064]George Best, 1973 against Liverpool - classic![/QUOTE] He said "header", not "headliner" :) | |
Re: Since you didn't post any code I can only guess that you failed to include header files and identify the namespace. [code] #include <iostream> using namespace std; ... ... /blabla [/code] | |
Re: I thought most modern c and c++ compilers supported some form of 64-bit integers. Try just "long long" instead of "long long int". | |
Re: You will never get exact precision with floating point because of the way they are represented in memory. | |
Re: What the hell are you talking about ?? DC as in Direct Current, or DC as in Washington DC? | |
Re: Yea, go buy one and set it up in your back yard. I wounder if your neighbors will notice :) | |
Re: change [icode]#include <string.h>[/icode] to remove the .h extension -- [icode]#include <string>[/icode] That will not fix all your proglems will fix some of them. | |
Re: Here is one of several ways to do it. Run this little program so you can see what it is doing. [code] #include <iostream> #include <sstream> using namespace std; int main() { size_t pos; string tm = "01:02:03"; char c; int h = 0, m = 0, s = 0; … | |
Re: Obviously Dani doesn't mind or she would have deleted it a long time ago. | |
Re: The best part of arguing with your GF is making up and making out. Don't let disagreements linger very long, especially never ever over night. When the sun sets its time for YOU to resolve all disputes. A lasting relationship means you tell your partner "I'm sorry." | |
Re: [URL="http://letmegooglethatforyou.com/?q=int+main"]int main[/URL] | |
Re: >>got it pulled from her child's kindergarten Christmas show OMG [color=red]CHRIST[/color]mas is all about religion. And there is nothing religious about that song. | |
Re: I'll take a couple of these: [URL="http://mywiki.ws/The_World's_Most_Expensive_and_Useless_Things"][quote]Damien Hirst’s sculpture, titled “For The Love of God”. It represents a platinum skull encrusted with 8,601 diamonds, eye and nose sockets filled with hundreds of jewels and a 52-carat pear-shaped stone fixed on the forehead, which is further bordered with 14 diamonds. It … | |
Re: [QUOTE=praveen_dusari;697836]hey today my brother said other than thinking about subject u can do nothing n that`s why this profession suits me. i thought this must be nice topic to start if you were not in this field what u will do or which profession you will opt to start with … | |
Re: double posted [URL="http://www.programmingforums.org/post155457.html#post155457"]here[/URL] | |
Re: To do that you have to get down to the nitty-gritty with the operating system. The curses library (*nix) or ncurses (MS-Windows) will make that easier for you. For MS-Windows there are several other options depending on the compiler you are using. | |
Re: Welcome to DaniWeb. Sorry I had to snip all that information, but rules are rules. You can include some of it in your personal information in your CONTROL PANEL, link at the top of each page. There are a few of us old farts around here, welcome to the crowd … | |
Re: >>e.g. data1.c The file extension is somewhat important -- *.c files are normally c programs, not data files. Your data file should be names "data.txt". You need to store the data in an array of struct sale objects. What you are doing is just overwriting all the data on each … | |
Re: Have no idea what you are talking about. What is "lsass.ess"? An operating system? application program? Please post in the correct DaniWeb board. This one is only for intruductions, not questions. Tell me what it is and I'll move it for your. |
The End.