15,300 Posted Topics
Re: >>*src++; line 9: remove the star -- you need to increment the pointer, not what the pointer is pointing to [icode]src++;[/icode] line 15: >>*src=&temp; //c2440 You can't do that either. *src is a single character and you can not assign it a pointer to a character array temp. I don't … | |
Re: Seek to the end of the file and call tellg(), or whatever function boost used to return the current file position. | |
Re: There are a lot of different kinds of databases, from simple text files, binary files, SQL relational databases (such as MySQL). The node structure doesn't lend itself to binary files very well because of that character pointer. Since the linked list will be relatively short you would probably want to … | |
Re: The value of [b]A[/b] is 60, yet you have a loop that assumes its 600. Change that loop like this: [icode]for(i=0;i<A;i++)[/icode] | |
Re: >>Is this safe to assume its the same on all c++ compilers? No. See limits.h for size limitations. >>Why does 'printf("size of size_t: %d\n",sizeof(size_t ));' make a warning? Probably because size_t is unsigned long and %d is signed int. Try %u and see if the warning persists. >>The size_t is … | |
Re: line 77: your class does not have a GradePoint() method. You need to add that. If you have learned about overloaded operators yet you could also do it by overloading the > operator so that you can do this: [icode]if( xStudent > yStudent )[/icode] | |
Re: Never heard of them either. But after reading [URL="http://cisnet.baruch.cuny.edu/holowczak/classes/3400/relationalalgebra/#selectionexamples"]this[/URL] I tink its nothing more than the WHERE clause in SQL statements. [icode]SELECT Name,Office,Dep,Rank FROM mytable WHERE dep = 'CS';[/icode] That is an SQL example select statement. Put quotes around it, make it a string, then send it to an SQL … | |
Re: >>So my question is, how do I from within the constructor verify that the length of the array is at least 3 ? You can't, which is one big reason vectors were invented. What you might want to do is change the constructor to accept a vector so that it … | |
Re: >>i = rand() % m_QNo; You want to use 300 there, not m_QNo. | |
Re: It doesn't write to the file because account_details() only writes to the screen. To fix that I would add a parmeter which would be either cout or an ofstream object [code] void Account::account_details(ostream& out) { out << // blabla } [/code] example: [code] #include "stdafx.h" #include <iostream> #include <fstream> using … | |
Re: You can't make the return value of that function anything other than an integer. Why? Because they are not normal functions -- it acts more like a self-contained process than another function, except that threads have access to all global data in the entire program. So when a thread returns … | |
Re: I've worked with MFC pretty extensively, and I can say for certain that it's at times a pain in the ass. I have not worked with it since VC++ 2005. If you're just getting started with GUI then I'd suggest you learn a more portable GUI package which works with … | |
Re: which line(s) are producing those errors? Or are we supposed to guess. | |
Re: The macro NULL is intended for pointers, not integers, Instead of casting NULL to int why not just pass 0? It would make more sense. Example: line 11 should be like this: [icode] if ( numOfArrays == 0 && sizeOfEachArray == 0) [/icode] Remember: integers are not pointers (normally) so … | |
Re: delete the while statement on line 64. It doesn't seem to have a useful purpose. | |
Re: I'm confused about what you mean by send to a data file? Or data queue? Are you talking about sockets -- sending packets via sockets to another computer? Or are you talking about copying a file 128 bytes at a time ? | |
I'm putting my Q. here instead of the c++ board because this is not a c++ question, but rather a compiler question. I just installed vc++ 2010 express and the first difference I noticed is that Microsoft removed the Build menu and all its options. Now there is only one … | |
Re: >>can i use dosbox for executing those programs Install and try it yourself to find out. | |
Re: One way I have done it is to use the standard DOS [b]^A[/b] notation. For all values 1-32 just add 'A' and the caret. | |
Re: >>i have googled it, but no solution. Not surprised. You are using a 20-year-old compiler (first released in 1991) that knows nothing about windows long file names and paths, can access only about 400K memory even though your PC might have several gigs, could easily corrupt your hard drive if … | |
Re: [QUOTE=Helpgirl;1189779]Thank you though, but i dont want all of it, i just do get how i put the array and the loop to get to work together. Thank you :D[/QUOTE] First create an array, such as [icode]int myarray[10];[/icode]. Open a file and read data into each element of the array. … | |
Re: Yes that can all be done, if you have the time, experience, and talent to do it. A GUI version would require a lot of graphics coding, such as creating the bitmaps with some sort of paint program. I don't do that kind of coding so I have no idea … | |
Re: maybe this will work for you. It doesn't need two counters -- only one is sufficient. If you are trying to read words then why is wordcount an int array instead of std::string array? [code] int countwords(ifstream& infile, int wordcount[MAX_WORDS]) { int count = 0; while( count < MAX_WORDS && … | |
Re: There could be lots of reasons for that -- other things running on your computer will affect the runtime of your program. | |
Re: >>i want to write this program without lib and string files Not possible. You need standard C libraries in order for your compiler to produce the executable program. If you don't want any libraries then you have to first delete (remove) all those header files in lines 1 to 4, … | |
Re: >>enum_key() Change that for loop to a while loop. RegEnumKeyEx() will return ERROR_NO_MORE_ITEMS when done. [code] int i = 0; while( RegEnumKeyEx( /* blabla */) != ERROR_NO_MORE_ITEMS ) { } [/code] | |
Re: Very few, if any, members here know what those SDL functions are. Is that a library of some kind? If it is, post the link to it. | |
Re: Writing binary file would be more efficient, but unreadable with any standard text editor such as Notepad. Note that file_out has to be opened in binary mode. [code] file_out.write( (char *) atoms, sizeof( atoms)); file_out.write( (char *)&origin_x, sizeof(origin_x)); file_out.write( (char *)&origin_y, sizeof(origin_y)); file_out.write( (char *)&origin_z, sizeof(origin_z)); [/code] Then to read … | |
Re: Worked ok with my compiler (vc++ 2010 express) | |
Re: Create an array of pointers, then read each line and add to the array [code] char *data[200]; // 200 lines of data char line[255]; // one line from the data file fgets(line, sizeof(line), fin); data[0] = malloc( strlen(line) +1); strcpy(data[0], line); [/code] Now put the above in a loop so … | |
Re: >>When I do a break point the subjectcode is 84 T. Is the 84 the equivelant to T? Yes -- look at any [URL="http://www.asciitable.com/"]ascii chart[/URL] and see for youself. subjectcode is declared as char, therefore the >> operator will treat is as such. Declare it as an int then test … | |
Re: Download and install MySql++. Its a free c++ class for MySQL databases. Of course you will have to have MySQL installed on your computer. If you have VC++ 2008/2010 Pro or better edition I believe it has all the plugins you need to create and maintain databases. But if you … | |
Re: That's supposed to be the class constructor, so code it like this [code] Triangle::Triangle(int side1,int side2,int side3) { } [/code] | |
Re: move lines 9-11 up to between lines 1 and 2. As coded, line 4 can not use cout because it doesn't know what cout is. Other than that, what is the problem with your program? | |
Re: Find out where you are calling fscanf() then check that the FILE stream has been opened successfully (check if it's not NULL). You probably are not checking if fopen() succeeded. | |
Re: >>Does this mean I have an error within the program, Yes, your program is buggy. Coding and getting a clean compile is only about 25% the job of a programmer. The other 75% if fixing bugs. >>or could there be an error in the compiling process? Unlikely. Don't blame the … | |
Re: read the file as integers not strings. Then just keep track of the maximum integer read. If you use ifstream then the >> operator will convert the number to an integer, your program won't have to do the conversion. [code] int number; ifstream in("filename.txt"); while( in >> number) { } … | |
Re: google for binary search algorithms. [edit]Oops! Didn't see firstPerson's response. | |
Re: >>There is a yearly membership fee of $500.00 and a monthly usage fee of $3500.00. I would attend a different fitness club. Gold Gym only charges about $35.00/month. And the last time I checked the YMCA was $45.00/month. Why would I want to spend $3,500.00/month for that crappy health club? … | |
Re: >>The little programm should run and close another aplication Nope. Not even close to doing that. It is starting 4 programs, not stopping them. >>int time[arrayLength]; Rename that array because [b]time[/b] is a function name. >> int w = Time; why? you don't need that extra variable in your program. … | |
Re: You need to make that a blinking sign that changes color frequently so that people will notice it. And the letters should scroll across the screen similar to scrolling banners.:) | |
Re: Your terminology sucks -- its "reading the data file", not "importing" it. Your program is reading the data file all wrong. google for and read tutorial about "c++ file i/o". | |
Re: Also scroll down the page and check the box "Disable Smilies" so that all those smilies do not appear. | |
Re: write a recursive function to do it. But don't make the two arrays very large because recursion takes up a lot of stack space. | |
Re: So just add the full path to the filename. [code] str = "C:\\user\\user\\Desktop\\history\\" + str; str += ".txt"; [/code] | |
Re: Just go to your CONTROL PANEL (see the link at the top of the page) and change your profile settings. | |
Re: Ok -- so what is your question? If this is on your final exam then that means you are at the end of your course. At that point you should already know how to read a file into arrays. | |
Re: Why did you define NULL_CHAR? Most people just use NULL definition that standard C header files already define. There is no point defining your own. The function's return value shloud be [b]char*[/b] (you need to add the star) | |
Re: A file can not be opened by merely giving fstream the path. It also need the filename. And use fstream's open() method. Search the net because there are billions of examples. | |
Re: [QUOTE=Muhammadlodhi;1189386]I need your help AT ONCE plz IN C CODE ONLY [/QUOTE] Go get stuffed. I wouldn't help you now even if I wanted to just because of your crappy attitude. |
The End.