1,174 Posted Topics
Re: [QUOTE=Jennifer84;616278] However I wonder why it goes up to 130 MB, that is a lot more than perheps it should be about 70 MB instead.[/QUOTE] Every std::string object that you push onto a vector has its own overhead. You can check in code what sizeof(std::string) gives to be the size … | |
Re: Try relocating the outtext(item) call ... [CODE] void boxout(int xstart,int xend,int ystart,int yend,char item[]) { setcolor(BLACK); moveto(xstart,ystart); setcolor(LIGHTGRAY); setfillstyle(SOLID_FILL,LIGHTGRAY); rectangle(xstart,ystart,xend,yend); floodfill(xstart+1,ystart+1,LIGHTGRAY); for(int i=xstart;i<=xend;i++) { putpixel(i,ystart,WHITE); putpixel(i,yend,DARKGRAY); } for(i=ystart;i<=yend;i++) { putpixel(xstart,i,WHITE); putpixel(xend,i,DARKGRAY); } [COLOR="Green"] outtext(item);[/COLOR] }[/CODE] | |
Re: [QUOTE=pa3k80;616198]How make in MFC C++: i need a function, the function has read a txt file and put a message box with text which is in txt file.[/QUOTE] Below is one way of doing it [code] void some_function() { CStdioFile File; CString strLine; CString strMsg; if(File.Open("file.txt", CFile::modeRead)) { while(File.ReadString(strLine)) { … | |
Re: The buffer next_room_script[] lives in the scope of the containing if() block. Your problem will go away if you change the m_nextRoomScript to be a std::string because the string will copy and hold the data you have read from the file. The pointer version just points to the temporary buffer … | |
Re: 1) To make the call Date::set_default(), needs the set_default() to be a static member function. 2) It is not enough to declare a static member variable inside the class declaration, you also need to define and optionally initialize it. [code] class Date { // a non-const default date static Date … | |
Re: [QUOTE=banban2008;615543]tell what should i do and how ????[/QUOTE] I think you should study from the very beginnings of C++. See [url]http://www.cprogramming.com/tutorial.html#c++tutorial[/url] for a beginner's tutorial, especially pay attention to topics you need "if , case , while , switch, functions". Take your time to go through it, and maybe post … | |
Re: [QUOTE=joshmo;615530]but i dont know where to start..i have tried comparing strings but i get stuck on [B]how the loop should ignore [/B]the string "hello 33"[/QUOTE] [B]Ignoring[/B] the string is the same as not writing it to the output file at all. Like Salem stated: Now in the while loop you … | |
Re: [QUOTE=JoE Guana;615229]Hey I made this function i think it'll do the job. But i keep getting an expected declaration before "}". What do you guys think? [/QUOTE] Hi, First of all, I repeat what VernonDozier already stated; [B]Use code tags and formatting please:[/B] see here [url]http://www.daniweb.com/forums/misc-explaincode.html[/url] Then about the errors … | |
Re: You might find ZedGraph useful, it's a class library written in C#. The project's web site is here [url]http://zedgraph.org/wiki/index.php?title=Main_Page[/url] And some sample projects can be downloaded here [url]http://sourceforge.net/project/downloading.php?group_id=114675&use_mirror=heanet&filename=zedgraph_sample_projects_5.1.2.zip&83843110&testing=1[/url] | |
Re: Move the definition of QStringList FuncCntrlParams::type_pairPotList into the respective .cpp file. | |
Re: Add e.g. a Reset() member function in which you reset the member variables to desired values. | |
Re: This is simple to fix ... relax [code] Employee employee1(); // <- actually declares a function returning an Employee // instead use ... Employee employee1; [/code] If the Employee's constructor would take argument(s), then you could have it like [code] string FirstName, LastName; Employee employee1(FirstName, LastName); [/code] Regarding code tags, … | |
Re: [QUOTE=people123;614276]The part that I am stuck at: [url]http://img60.imageshack.us/img60/993...webhelpqj4.jpg[/url][/QUOTE] You have to select the correct list from the "Show directories for:" list Then click the yellow folder image to add a new entry to the list and enter the path. [I]<SDKPath>[/I]\Include directory goes into the "Include files" list and [I]<SDKPath>[/I]\Lib into … | |
Re: If your intention is to convert a string of digits to a long value, then see the strtol() function [url]http://www.cplusplus.com/reference/clibrary/cstdlib/strtol.html[/url] | |
Re: [QUOTE=SonxQ7;612718]Excel 2003 has both LOG() & LOG10(), why would the LOG() in spreadsheet be log10() in C? [/QUOTE] Unable to answer that one, but just for reference: Compute natural logarithm / log() [url]http://www.cplusplus.com/reference/clibrary/cmath/log.html[/url] Compute base-10 logarithm / log10() [url]http://www.cplusplus.com/reference/clibrary/cmath/log10.html[/url] | |
Re: [QUOTE=CoolGamer48;613525]Also, is there a way to check if the end of a file has been reached with ifstream? Because I'm using feof() in my program.[/QUOTE] see [url]http://www.cplusplus.com/reference/iostream/ios/eof.html[/url] | |
Re: The end condition for the loop where you iterate over the list might be wrong or your list is not terminated properly (or something else). If you've been wondering about this for a week now, it is probably better to post code that is relevant to the problem. | |
Re: I think the link step is missing the wrapper library itself (libmysqlwrapped) in which the Database class' code is. So you need to find out where that library is and link with it too. | |
Re: I think you might be missing the point 'The latter being trivially true all the time.' i.e. you have to write the if statement like: [icode]if (f == 1 || f == 3) [/icode] If you write it like: [code] if (f == 1||3) // or if (f == 1 … | |
Re: [QUOTE=zawpai;612087]but I really don't know where the error is. The compile's error is the following: LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main [/QUOTE] Change mian() => main(). Also, really please use the code-tags feature when you post code. [url]http://www.daniweb.com/forums/misc-explaincode.html[/url] EDIT( this post just became so redundant because Niek_e cooled … | |
Re: If you want to stick with the original [icode]ostream& operator<<(ostream& out, [COLOR="Green"]const[/COLOR] Card& c)[/icode] then you need to make the getSuit() method also const .. [code]const char getSuit() [COLOR="Green"]const[/COLOR]; // and ... const char Card::getSuit() [COLOR="Green"]const[/COLOR][/code] One more link for you .. [url]http://en.wikipedia.org/wiki/Const_correctness#Methods[/url] | |
Re: Use plain %f with a double with printf(), see [url]http://msdn.microsoft.com/en-us/library/hf4y5e3w(VS.80).aspx[/url] Mr Sinkula once pointed out (to me) that: "using %lf with printf is undefined behavior in C90, a common nonstandard extension, and standardized in the uncommonly-implemented C99 as ignoring the l." | |
Re: [Code] // Your thread accesses the form via a variable named 'Form2' // The 'Form2' variable below is local to the function and hence // hides the intended 'Form2' variable i.e. the correct 'Form2' does // not get assigned to anything. [COLOR="Red"]TForm2 *[/COLOR]Form2 = new TForm2(this); Form2->ShowModal(); [/Code] | |
Re: Try printing the arguments the program receives, I think you are simply not calling it correctly (maybe e.g. due to spaces in file paths) [code] if (argc != 3) { cout << "Usage: compfiles <file1> <file2>\n"; for(int ii = 0; ii < argc; ++ ii) { cout << "Arg# " … | |
Re: The totalProduct pointer probably is not what you expect it to be inside the [icode]void Customer::getCustomerProduct(...)[/icode]. I.e. you have not allocated any Products and are trying to call getProduct() on a non-existing object. totalProduct is left uninitialized at this point <-> you should initialize it to zero in the Customer's … | |
Re: Shouldn't you change from 'int *prt;' to 'decode *prt;' ? Then you could change to [code][B]ifstream &[/B] decode::loadDecode(ifstream &fin) { fin >> alphabet; fin >> code; return fin; } // ... and use it like while (de.loadDecode(fin)) { prt = new decode(de); // you are not checking the result of … | |
Re: That happens because you have [icode][B][COLOR="Red"]System::DateTime[/COLOR][/B] LastSourceTime = CurrentSourceTime;[/icode] <=> LastSourceTime is there a variable local to the if -block. You have to change it to simply: [icode]LastSourceTime = CurrentSourceTime;[/icode] | |
Re: With MFC you could lookup how to use class CStdioFile (see the Read() and GetLength() member functions). | |
Re: At least one note, somewhere along the code you have: [icode]output_file<<"Answer:" << endl;[/icode] and later on you are attempting to read in values from the very same file [icode]in_stud>>m[i];[/icode] That just silently fails because of the string you have written there (I'm assuming here that m[] holds floats <-> I … | |
Re: You could write a condition statement also so that the variable is on the right side of the expression, i.e. [icode]if (0 == noModsPassed07)[/Icode] This way your compiler will spot an obvious error, i.e. [icode]if (0 = noModsPassed07)[/Icode] will not compile. | |
Re: If it is sufficient to use the time the file was last written as an indicator of a change, then you can utilize GetLastWriteTime(), like: [icode]System::DateTime LastWriteTime = System::IO::File::GetLastWriteTime("file.txt");[/icode] I.e. at some point store the time and then later on compare the times to see whether there is a change. | |
Re: [QUOTE=hocuz pocuz;610622]can you also write in text or only binary?[/QUOTE] If you will write the data as Ancient Dragon showed, then use the binary mode only. | |
Re: [QUOTE=Sky Diploma;609794]Should sky.exe >out.txt be written in a specific place? or anywhere else?[/QUOTE] Specify any location of your choice that you have write access to. Regarding the system() and std::string, you can use: [icode]system(some_string.c_str());[/icode] | |
Re: Lookup the Tool Help Library functions .. [URL="http://msdn.microsoft.com/en-us/library/ms684887(VS.85).aspx"]process walking[/URL] | |
Re: m_dwVersion IS a member of AFX_MODULE_STATE, but only when you compile with _AFXDLL defined. | |
Re: You have a mismatch in some of the functions, they are declared as returning a string but you are returning (0). Either return a string from those functions if you need to, or maybe change to e.g. [code]void ip_uri_store::uri_ip(string uri50, string ip50)[/code] if you will not be needing a string … | |
Re: Ancient Dragon's link is pretty much on the topic .. you can also find some complete MDI/SDI examples, with and without splitters, by downloading the sample code of the The MFC Answer Book, freely available here: [url]http://www.informit.com/content/images/0201185377/CDContents/Code.zip[/url] There are three demo applications related to switching views: SwitchViewMDI, SwitchViewSDI and SwitchViewSplitter … | |
Re: If the format is as follows SER(FIT): 7.6e-003 1.3e-002 1.2e-002 1.5e-002 5.2e-003 you can parse a line by ignoring the 'SER(FIT): ' and then extracting the floating point values. See below ... [code] #include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream in("file.txt"); string dummy; double … | |
Re: :icon_wink: Well, you just have to step forward and post something relevant to the problem(s). | |
Re: [QUOTE] "." should be found and displayed, but it isn't.[/QUOTE] You are missing the initial match ... [code] ... long nHandle = _findfirsti64(s_filename.c_str(), &struct_filedata); if(nHandle >= 0) { [B]cout << "First match is: " << struct_filedata.name << '\n';[/B] while(_findnexti64(nHandle, &struct_filedata) == 0) { ... } [/code] | |
Re: [QUOTE]when i hit the "New" menu from the File menu it doesn't erase or clear my drawing I don't know why.[/QUOTE] A bit difficult to answer because not knowing how your drawing code is setup, so I [B]guess[/B] that the drawing code is within the view class/file i.e. the document … | |
Re: You exceed the array bounds by using the pre-increment operator in [icode]Temperatures[++Count] = CurrentTemp;[/icode] change it to [icode]Temperatures[Count ++] = CurrentTemp;[/icode] | |
Re: Try Ctrl + Shift + 8 | |
Re: Save the current working directory (_getcwd()) before you save a document and then restore it using _chdir() after that. (Assuming that you are unable to make changes to the serialize function to prevent it from changing the directory in the first place). | |
Re: [QUOTE=mertucci;607745]but i want to take numbers from user how can i ?[/QUOTE] You already correctly take all the input from the user by using cin, e.g. the following works [icode]cin>>x;[/icode] But you cannot call a function like this: [icode]hesap.arith_ex(int x,int y ,int z);[/icode] The above line actually generates all of … | |
Re: Just pointing out some very simple errors you have there ... [code] class CollegeStudent:public Person { public: char nameofclass [B][COLOR="Red"];[/COLOR][/B]// need a semicolon here void goster2(); }; CollegeStudent::goster2() // [B][COLOR="Red"];[/COLOR][/B] <- must not have a semicolon there { cout<<"Name of Class"<<name[B][COLOR="Red"]o[/COLOR][/B]fclass<<endl; // A typo there, typos are fatal } ... … | |
Re: You could write a simple comparison function that you can supply to the std::sort(). [code]bool MyCompare(const string & lhs, const string & rhs) { // std::sort() calls this function each time it needs to determine the // order of two items .. // // Todo: compare here the strings in … | |
Re: << if I try to push changed data using function, I get just the [COLOR="Red"]same word n times[/COLOR]: That happens because you are pushing pointers to one single buffer you have in your whole program, and that buffer is char recordd[]. In other words, you can write to that buffer … | |
Re: << Block.obj : error LNK2001: unresolved external symbol "protected: static class Texture * << Block::m_img4" (?m_img4@Block@@1PAVTexture@@A) [code] class Block : public Object { public: Block(); ~Block(); <snip> protected: static Texture* m_img1; static Texture* m_img2; static Texture* m_img3; static Texture* m_img4; }; // outside your class initialize the static member variables … | |
Re: You are not reading anything from the file, you only open the file and then enter an infinite loop incrementing j on every round. You must read in some data in order to compare the value of vardas. Furthermore, about [icode]while(!kd.eof())[/icode], please take a look in here [url]http://www.daniweb.com/forums/post155265-18.html[/url] And lastly, … |
The End.