Jump to content
xisto Community

kvarnerexpress

Members
  • Content Count

    413
  • Joined

  • Last visited

Everything posted by kvarnerexpress

  1. Want to tell us about how fantastic your (or your mates') band is? want to give us all links to check out their stuff?Yes?Then this is the thread you're looking for. natter away on here to your heart's content. Just don't slag off anyone else's band, and don't expect us to become as fanatical about them as you.Please note that any topic started on this forum to promote your band is likely to be deleted.'Love is the Law,Love under Will'
  2. I'm working on a bitwise problem where I can't use loops or logical operators. I need to return 1 ix x<y else return 0. The valid operators that I can use are ! ~ & ^ | + << >>My code that isn't working so far is:/* isLess - if x < y then return 1, else return 0* Example: isLess(4,5) = 1.* Legal ops: ! ~ & ^ | + << >>* Max ops: 24*/int isLess(int x, int y) {return ((x + (~y + 1)) >> 31 ) ;}It seems to have problems with the negative numbers.Going insane!
  3. Hey i looked into this and saw there were two methods: memory mapping and data_seg(built in memory mapping)however, being the noobie i am i can't seem to get this to work - all i want to do is share a few integers and bools across multiple(in this case - two) Dll's (these are injected into an exe) i.e 'int test' is set to '3' in first.dll -- and subsequently in second.dll 'test' is also set on to '3', and then i can perform if statements while the two values are the same over the 2 dll's
  4. have a file that we are supposed to use as input. It looks like this:Code:name:curriculum:gradyear:ssn:dobI'm going to read it in a buffer, but trying to find the logic to seperate the fields and then place in a variable. I was thinking something like:Code:if(ispunct(buf[x]) != ':') strcpy(s->name, buf);Any suggestions is greatly appreciated!
  5. kvarnerexpress

    Enums

    if i'm using enums, i can use it as the variable name and as a numerical value, correct?ex: enum dayOfWeek {monday, tuesday, wednesday};dayOfWeek day;day=monday;orday=1;or it can only be used one way?please help
  6. USE SEARCH FIRST!There is a pretty good chance that unless you have somereally odd or unique problem that it has been addressed on thisforum before (or even hundreds of times before for some issues).Use the forum's search feature first to see if there are already some good threads on the subject. It's easy to search - just click the "Search" button at the top right of the page.Be DESCRIPTIVEI cannot stress this enough. We cannot possibly help you if you simply post a thread, copy and paste your whole script and say "it has errors what's wrong with it?". Keep this in mind:1. Explain to us what your script DOES (or what it's supposed to do).2. Explain to us what exactly the error is. Is it a Javascript error? Your own error reporting? Database error? Or is it just not doing what you want?3. Remember that you know a lot more about your script than we do. Don't assume we know just what it does.Don't use stupid topic namesPost a descriptive topic name! Give a short summary of your problem IN THE SUBJECT. Don't use attention getting subjects. They don't get attention. They repel attention and annoy people.Here's a great list of topic subjects YOU SHOULD NOT POST by freebsd:1) Help me 2) Hello 3) You must know the answer 4) Please help this female newbie5) Something wrong 6) Come on PHP gurus 7) This one for you 8) Just wondering 9) This is too complicated for me 10) possible? 11) Very urgent 12) I have a question13) Stupid question14) Newbie needs help15) pulling my hair out16) this is driving me nutsGenerally ANYTHING similar to those is unacceptable. Just post your problem.Here is a good example of a way to post a question about ereg() and regular expressions / validating emails"Need ereg regular expression help"or even better:"validating emails w/ ereg() regular expressions"These are bad examples:"I can't figure this out!""Stupid question...""Female newbie needs regex help""Help me! Urgent!"ONLY POST THE PART OF YOUR SCRIPT THAT HAS PROBLEMS!PLEASE do not post your entire script in a message. And if you have to use 2 messages that's a good indication that you're going to annoy people. Only post the part of your script where you have problems. That's it. Just a very small piece of it. It's not hard. Just find the part you think doesn't work and post that. WE DON'T WANT TO SEE YOUR ENTIRE SCRIPT. And if you post the entire script it's going to take us a lot longer to find the problem.PUT YOUR CODE IN in vB code!!!Hundreds of times per week we see people post a huge ugly script right into the message. There's a problem with that. The tabs don't work. There's no syntax highlighting. That makes it difficult to read!There's a really neat vB code built in that will format and syntax highlight your code when you post it. You can use that easy PHP button right above the box where you type your message. The result will look like this:PHP Code:// this is some easy to read PHP code if($your_code_is_easy_to_read) { people_like_it(); } Or if you are using other languages use [...code] [.../code] tags around it for similar effect. (REMOVE PERIODS)If you get an error on a certain LINE, tell us what's on that line and what's on the few lines above it!It's not too helpful when you mention an error on a certain line but don't tell us what code is on that line. Because errors can sometimes be caused by lines of code above the one the error is mentioned on, please post a few lines above that line.Only you know what "doesn't work" meansPlease tell us what your script is supposed to do and why it "doesn't work". Or if you don't feel like explaining what the whole script is, at least tell us what the offending code is supposed to do. When you come in and say "it doesn't work" or just "it has errors", that means NOTHING. There could be a million things wrong and no one will know where to look.If you're not going to take the advice, don't ask for help.Often times, people post questions about their script with the wrong mindset from the very beginning. Soon they are receiving replies, and silently debugging their code, making no effort to even acknowledge the people helping them! It becomes one sided, and the poster isn't aware that many of the people helping them hope to learn something as well! Letting people know of your progress and how their suggestions apply (or do not apply) will not only help you figure out your problem quicker, but you'll be returning the favor to those of us who learn more by helping.In even worse scenarios, sometimes the poster will argue back even when they don't know what they're talking about. Hey - if you know it all, don't ask for help.When people give you free code that may solve your problem, by all means, try it out! And if it's not what you need, at least thank them. And if people post code that is over your head, ask them for an explanation. Too many times I see great solutions posted, then the original poster doesn't understand it and goes hunting around the manual and finds some function they think will solve their problem but really has Nothing to do with their problem! The solution you are given may not always be something you are totally familiar with, so just ask for a better explanation!Remember when people help you, they are doing YOU a favorRegardless of how big your ego is, it is NOT someone else's privilege to debug Your code. It is not their privilege to have them help you. It is YOURS. Remember that when people help you they are doing YOU a favor. You are not doing them a favor by letting them see your incredible application. Be patient, help people out by posting good descriptions of what you need help with, and not snapping at people with garbage such as "if you aren't going to help don't waste my time replying".
  7. Anyone know of a good way to sort a list of files if I give a path like C:\myDirectory\*.cmd that will return a sorted list of all cmd files in the directory? I don't need in a CFile object or anything like that, just a list of strings. Even all files in the directory would be fine, I can filter out non-cmd files after that.Thanks in advance.
  8. Ok, I've been in school for about 2 years now and can't figure out what the heck these people are really doing for me. Being an older student, I really just want to get a job. I make good grades and never have any problem understanding the material with which I have thus far been presented. Can anyone give me any insight or advice regarding the c++ (or any other) certification process and/or the prospects for getting a job with these certifications?thanks
  9. I'm making an oct tree to divide up a colour space.Each tree has 3 upperbounds, and 3 lowerbounds, 1 pair for each axis.I store it's children in a 3D array. 2 by 2 by 2.m_pChildren is of type pointer to a pointer, and is initilized like this:Code:void COctTree::CreateChildren(void) { m_pChildren = new COctTree*[2,2,2]; for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { for(int k=0;k<2;k++) { m_pChildren[i,j,k] = new COctTree(); //Setup boundaries m_pChildren[i,j,k]->m_pLowBounds[0] = m_pLowBounds[0] + i * ((m_pHighBounds[0] - m_pLowBounds[0])>>1); m_pChildren[i,j,k]->m_pHighBounds[0] = m_pLowBounds[0] + (1+i) * ((m_pHighBounds[0] - m_pLowBounds[0])>>1); m_pChildren[i,j,k]->m_pLowBounds[1] = m_pLowBounds[1] + (j * ((m_pHighBounds[1] - m_pLowBounds[1])>>1)); m_pChildren[i,j,k]->m_pHighBounds[1] = m_pLowBounds[1] + (1+j) * ((m_pHighBounds[1] - m_pLowBounds[1])>>1); m_pChildren[i,j,k]->m_pLowBounds[2] = m_pLowBounds[2] + k * ((m_pHighBounds[2] - m_pLowBounds[2])>>1); m_pChildren[i,j,k]->m_pHighBounds[2] = m_pLowBounds[2] + (1+k) * ((m_pHighBounds[2] - m_pLowBounds[2])>>1); } } } }From stepping through the code it appears to work fine. However when i access the values i get strange results.Here's how i'm using the children:Code:if(!m_pChildren) CreateChildren(); //Now insert the pixel into the appropriate child for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { for(int k=0;k<2;k++) { //Loop through each child bool IsInSector = true; for(int l=0;l<3;l++) { //Loop through each dimension int tmpInt; if(!Colour[0] && !Colour[1] && !Colour[2]) cout << (tmpInt = m_pChildren[i,j,k]->m_pLowBounds[l]); if( (Colour[l] > m_pChildren[i,j,k]->m_pHighBounds[l]) || (Colour[l] < m_pChildren[i,j,k]->m_pLowBounds[l])) { IsInSector = false; } } if(IsInSector) { //The pixel can go in this (child) sector in the colour space m_pChildren[i,j,k]->InsertPixel(Pixel,Colour); return; } } } } cout << "Pixel Not Placed in Oct Tree!!!" << endl;Here it loops through each child checking the bounds to see if we can place the pixel in it. If so it does, if not it moves to the next one.Now, every pixel should get placed, in one child, but that's not the case. Can anyone see anything wrong with what i'm doing?
  10. who is da best drumer of all timeid say ....that williams from oasis hes wicked or ohh gone balnk from queen and spit upon the name of oliver cromwell and denouce his royal line that will slaute him FOREVERtalkin about Roger Taylor. He's working for Jaguar now. Living:Danny Carey (Tool, Pigmy Love Circus)Stephen Perkins (Jane's Addiction, Porno for Pyros)Matt Sorum (G'n'R, The Cult)Chad Smith (RHCP's)Matt Cameron (Soundgarden, Pearl Jam)
  11. I have a HTML file which I use to logon to my account easily It When I open it I get a normal HTML page in frond of me where I can push the button to login to my webpage.Is there a possibility to open the HTML file and go directly into my page?Now it uses input fields like this which are hidden:<input type="hidden" name="username" value="The username in used here" /><input type="hidden" name="password" value="The Password is written here" />It would be nice if someone knows how to make a sort of a executeble out of it, so I only have an icon on my desktop which I can use to login.This is the file in total which I use now:<html><head><link rel="stylesheet" href="http://forums.xisto.com/no_longer_exists/ en Agenda</title></head><body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" ><script language="javascript" type="text/javascript" src="http://forums.xisto.com/no_longer_exists/ type="text/javascript" language="javascript">function hidestatus(){window.status='Group-Office 1.13'return true}if (document.layers){document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)}document.onmouseover=hidestatusdocument.onmouseout=hidestatus</script><!--Einde header--><form method="post" action="http://forums.xisto.com/no_longer_exists/; name="login"><table cellspacing="0" cellpadding="15" width="100%"><tr><td align="center"><input type="hidden" name="table_tabindex" value="0" /><table border="0" cellpadding="0" cellspacing="0" class="TableBorder" width="400"><tr><td valign="top"><table border="0" cellpadding="1" cellspacing="1" width="100%"><tr><td colspan="99" class="TableHead">E-Mail en Agenda</td></tr><tr><td colspan="99" cellpadding="10" cellspacing="0" class="TableInside" height="300" valign="top" width="100%"><input type="hidden" name="task" value="login" /><br /><br /><table cellspacing="2" border="0" cellpadding="1" valign="center" align="center"><tr><td colspan="2"><h3>Klik op de knop om e-mail en agenda te starten</h3><br /></td></tr><tr><td align="right" nowrap> </td><td><input type="hidden" name="username" value="The username in used here" /><input type="hidden" name="password" value="The Password is written here" /><input type="hidden" name="remind" value="true" /></td></tr><tr><td colspan="2" align="center"><br /><input type="button" class="button" style="width: 100px;" value="starten" onclick="java script:document.forms[0].submit();" onmouseover="java script:this.className='button_mo';" onmouseout="java script:this.className='button';" /> </td></tr></table></td></tr></table></td></tr></table> </td></tr><tr></table></form><!--Start Footer--></body></html>
  12. I haven't seen any Maroon 5 strands, and I think they are worth talking about. Does their jazz-funk-popish sound sound like Jameraquai? Whatever or whosever sound they have, I think they're very talented. I am, however, getting tired of hearing She Will Be Loved everywhere I go! It's good when you go through their CD and you hear it, ONCE! But the overplaying of the song is not their fault... so I still love them.
  13. What song would you play at your funeral? Would it be something that will anooy everyone or would it be something that makes everyone want to dance and rejoice? Its up to you :DMine would beMine would be "Ah Ah Ah Ah stayin' alive stayin' alive."
  14. made a site. It's 95% done. It has some placeholder images and a little Lorem ipsum still - waiting for the rest of it from the client. The site uses PHP, CSS, no tables, no frames, Divs only. The CSS would validate except the customer opted for colored scrollbars. It is written to valid XHTML Transitional. I use NotePad. What happpened: It is being hosted on an Apache server I have. It was on this server all along, as it was being built (I also use Cute FTP). It ran really fast, even with a few heavy-ish graphics, and appeared to be an iFrames-type site, which is the effect what I was after. Well today I moved the site from http://forums.xisto.com/no_longer_exists/ to http://forums.xisto.com/no_longer_exists/ No big deal, I'm hosting them as a subdomain and really just moved a bunch of files and the images folder from one part of the server to another, through their new FTP account. I've done it before and I doubt it's my last time. The issue: To me anyway, the site is now slow when being viewed on MSIE 6.0. It appears to page-transition like any other site, in an odd way as well it seems, re-loading the single-file header, linksset, footer, page and div backgrounds. This is not an issue at all when viewing the site in its new location with Moz-Firefox 1.0, Netscape 7.2, or Opera 8 Beta. Only on IE. It seems obvious that all the files are present and accounted for, since it does perform as expect the other browsers. Another acronym comes to mind... wtf?!
  15. I get the following error while trying to connect to SQL Server using JSP.Login failed for user 'prashanti'. Reason: Not associated with a trusted SQL Server connection.My code is as follows:<html><head></head><body><%@ page import="java.sql.*" %><% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); %><% Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433","prashanti","prashanti"); Statement stmt = conn.createStatement();ResultSet columns = stmt.executeQuery("select * from employee");while(columns.next()){String name = columns.getString("name");String address = columns.getString("address");%><%=name%><%}%></body></html>Any help will be appreciated.Thanks,
  16. Just wondering if you guys have heard of (In order that come to mind) Safri Duo, Ian Van Dahl, Dj Tiesto, Barthezz. They're basically the only trance that i can thank of at the moment that i listen to, if you guys know of these post your views and such. And if not heck, post your favourite Trance or Techno artists.I dunno if this is the write forums for this, so don't flame me if it isnt .*Edit* I'd definately recommend Chicane for easy listening, great beats and tunes *Edit*Cheers--------------------------------------------------------------------------------No matter your status factors we hold in humble, no matter your foundation of solid, things can crumble. No matter the strength or length up to sustain, it never stays the same that's simply what the seasons change.
  17. Hello,I have a webpage that allows a user to upload a picture to the site. I know all my users are running at least internet explorer 6.1 and it works like a charm on desktop units.We are trying to roll out the samsung i-700 to our field agents for taking pictures and uploading them to the site while in the field. The device accesses the site with no problems, but where the input field for the picture is, it is gone.I looked on the microsoft website and it says that Pocket Internet Explorer doesn't support Data Binding. Is that what this is?Does anyone know of any other browsers for the pocket PC that will allow me to upload pictures from the field?Thanks!
  18. How do I convert a char array to integer/double/long type?Use the atoi(), atof() or atol() functions. Also see question 1.3 below.Code:#include <stdlib.h>int main(void){ char *buf1 = "42"; char buf2[] = "69.00"; int i; double d; long l; i = atoi(buf1); l = atol(buf1); d = atof(buf2); return 0;}1.2. How do I convert an integer/float/double/long type variable to a char array?Use sprintf(). Many books/websites tell you to use itoa(), itol(), itof() etc., but these functions are compiler specific and are therefore non-portable. sprintf() is definitely the way to go.Code:#include <stdio.h>int main(void){ int i = 42; float f = 69.0; double d = 105.24; long l = 23; char buf[50]; sprintf(buf, "%d", i); sprintf(buf, "%f", f); sprintf(buf, "%f", d); sprintf(buf, "%ld", l); sprintf(buf, "%d %f %ld", i, f, l); return 0;} C++ users may also use the stringstream or ostringstream class (the deprecated form was strstream class)Code:#include <sstream>#include <string>using namespace std;int main(void) { stringstream ss; int i = 42; double d = 105.24; ss << i << " " << d; // Convert to string or char array string s = ss.str(); char buf[50]; sprintf(buf, ss.str().c_str());}1.3. How do I convert a hex/octal/any-other-base value to a number?Use strtol() or sscanf().Code:#include <stdlib.h>#include <stdio.h>int main(void){ long l; int i; unsigned int ui; char *hexstr = "12FC3"; char *octstr = "1245"; char *binarystr = "1101"; l = strtol(hexstr, NULL, 16); l = strtol(octstr, NULL, 8); l = strtol(binarystr, NULL, 2); sscanf("12", "%d", &i); sscanf("14", "%ld", &l); sscanf(hexstr, "%x", &ui); sscanf(hexstr, "%o", &ui); return 0;}C++ users may want to use stringstream instead (strstream is deprecated).Code:#include <sstream>#include <string>using namespace std;int main(void){ long l; int i; char *hexstr = "12FC3"; char *octstr = "1245"; stringstream ss; ss << hex << hexstr; ss >> l; ss.clear(); ss << oct << octstr; ss >> i; return 0;}1.4. How do I convert an integer to hexadecimal (hex) /octal (oct)?Use sprintf().Code:#include <stdio.h>int main(void){ int i = 42; char buf[50]; sprintf(buf, "%x", i); /* convert to hex */ sprintf(buf, "%o", i); /* convert to octal */ return 0;}C++ users may want to use stringstream instead (strstream is deprecated).Code:#include <sstream>#include <string>using namespace std;int main(void){ int i = 42; char buf[50]; stringstream ss; ss << hex << i; ss >> buf; ss.clear(); ss << oct << i; ss >> buf; return 0;}1.5 What's the equivalent of perl/pascal/vb/php's chr() and ord() functions in C/C++?There aren't any functions like this in C or C++ and they aren't needed anyway. You can get a char's ASCII value by simply assigning it to an integer variable.Code:char ch;int i;ch = 'A';i = ch; /* Assigns the ASCII value of 'A' (i.e.) 65 to i */printf("%d\n", i); /* Prints 65 */To do the reverse (i.e.) what the ord() function does, simply assign an integer to a char variable. You'll need to force a cast to avoid compiler warnings for some compilers thoughCode:int i;char ch;i = 65;ch = (char) i;/* some compilers don't warn you if you do:ch = i;and some will, hence the explicit cast to char type. The castassures the compilers that warn you, that you know what you're doing. */printf("%c\n", ch); /* prints 'A' */Since characters and integers are treated somewhat alike in C/C++, you can perform arithmetic operations and comparision operations with char variables, just as you do with integer variables. For instance:Code:char ConvertToUpperCase(char ch) { if (ch >= 'a' && ch <= 'z') ch = ch - 'a' + 'A'; return ch;}The above code takes a variable as input and checks if it is a lowercase letter by comparing its ASCII value to see if it is between the ASCII for 'a' and 'z'. If so, it subtracts the ASCII value of 'a' and adds the ASCII value of 'A', thereby converting it to an uppercase ASCII value.How do I print an integer/char/char array/float/double/long/long double/long long?Use appropriate formatting strings (%d, %ld, %f, %Lf, %lld) with your printf statements.Code:#include <stdio.h>int main(void){ int i = 23; long l = 42; float f = 105.23; double d = 69.05; long double ld = 55.23; long long ll = 92; char c='a'; char s[] = "This is a string"; printf("int = %d\nlong = %ld\n", i, l); printf("float = %f\ndouble = %fd\n", f, d); printf("long double = %Lf\nlong long = %lld\n", ld, ll); printf("char = "%c\nString=%s\n", c, s); return 0;}C++ users can use cout and not worry about the format string types .2.2 How do I limit the precision/length of floating point, double numbers or char strings?Use the format strings to specify precision.Code:#include <stdio.h>int main(void){ float f = 105.2345; char buf[] = "This is a string"; /* Limit to 2 decimals */ printf("float = %.2f\n", f); /* Print 10 chars wide, limit to 2 decimals */ printf("float = %10.2f\n", f); /* Print 10 chars wide, limit to 2 decimals and left-justify */ printf("float = %-10.2f\n", f); /* Limit to 10 characters */ printf("%.10s\n", buf); return 0;}C++ users may use the iomanip functions setprecision() and setw() to do this.Code:#include <iostream>#include <iomanip>using namespace std;int main(void){ float f = 105.2345; char buf[] = "This is a string"; cout.setf(ios::fixed); /* Limit to 2 decimals */ cout << setprecision(2) << f << endl; /* Print 10 chars wide, limit to 2 decimals */ cout << setw(10) << setprecision(2) << f << endl; /* Right justify to 30 chars */ cout << setw(30) << buf << endl; return 0;}2.3 How do I control how many chars are read in a string when using scanf()?You can use the a format specifier in the scanf() function.Code:char buf[25];scanf("%20s", buf);The above code limits the length of the characters that will be read by scanf() to 20 characters maximum (note that the buffer can hold 25 characters though!)C++ Users can use either setw() or cin.get()Code:cin >> setw(20) >> buf;cin.get(buf, 20);Either statement does the same thing. Note that the above code will read 19 characters max and put \0 for the 20th character.
  19. Commonly Asked C/C++ Questions -------------------------------------------------------------------------------- Here are some answers to commonly asked C/C++ questions on the forum. If you are new to the forum, please read this thread as your question may already be answered here. This guide is divided into many sections: 0. Frequently Asked Newbie Questions (how do I pause output, compile my program etc.) 1. Converting types 2. Formatting Output 3. String manipulation (copy, concatenate, replace etc.) 4. File Manipulation (File size, dir contents, remove files etc.) 5. Secure Programming Practices for Newbies. This guide is a work in progress, so feel free to PM me with your suggestions In general, people on this forum generally use the following: On Unix-like OS (Linux, FreeBSD, OpenBSD, NetBSD, Darwin etc.): gcc tendra (this is a relatively unknown compiler though ). On Windows: Bloodshed Dev C++ (which uses gcc as the backend) Visual C++ Borland C++ and Borland C++ Builder 0.2 How do I compile my program? On unix-like systems: gcc -o exename myfile.c This will compile myfile.c to produce an executable file called exename. You can then run exename by typing ./exename On Windows systems, different compilers have different keys to compile a program. Bloodshed/Dev C++: Ctrl-F9 compiles, Ctrl-F10 executes. Visual C++: F7 compiles, F5 executes. Borland C++ Builder: Ctrl-F9 compiles, F9 executes. Turbo-C: F9 compiles, Ctrl-F9 executes. 0.3 I cannot see my C compiler output. The window is closing too quickly for me. This is a common question that many newbie programmers on Windows have. See http://forums.xisto.com/no_longer_exists/ for many solutions. 0.4 What are some handy C/C++ links? http://c-faq.com/ http://forums.xisto.com/no_longer_exists/ 0.5 Why does my scanf/fscanf/sscanf stop working? Most C input is provided in a stream. That is, it is a series of characters made available one at a time. The scanf() function family are format-sensitive functions; they not only collect the characters for you, but attempt to convert them to a type (such as an integer) that you specify. They have great difficulty converting ZyGH4 to a meaningful number so they fail. The conversion attempt is governed by format specifiers that YOU provide. Since these may not match the input actually encountered, the family returns a value indicating the number of items successfully scanned AND assigned. If this value is zero, you have nothing. If this value is EOF, there was an end-of-file or other error. If you don't examine the return, how will you know? If an error occurs it will not be automatically cleared. Operations on the stream will continue to return an error until clearerr(), fseek(), fsetpos(), or rewind() is called. This means that a loop that is designed to pause for input will loop indefinitely. The characters that f/s/scanf attempt to convert as one value are all the characters up to the first whitespace character (space, tab, newline) or up to the specified field width, or up to the first character that cannot be converted. (Note: The [ and c format directives are not whitespace delimited, but we won't consider them for the explanation here). If a character conflicts with the format specification, the function terminates and the character is left in the stream as if it had not been read. You probably will not expect it to be there to serve as input for your next call, so your input will not behave as you expect. Example of proper usage: int status; status = scanf ("%s%d\n", name, &number); Check the value of 'status' after the scanf() call. If it is not what you expect (two, in this case), you didn't get all your fields. If it is EOF, your stream is broken and will remain so until you clear the error. 0.6 Why does getline() not work correctly with Visual C++ (VC++)? Why do I have to type Enter twice for getline to process my input line? If you're reading this, you've probably noticed that getline() is not functioning the way your book says it should -- you need to hit <enter> twice for the program to read your input. For example: Code: #include <iostream> #include <string> using namespace std; int main() { string name; cout<<"Enter a name:\n"; getline(cin, name); cout<<name<<endl; return 0; } .................next day
  20. quite like the new single from their new album. I don't think i liked their other stuff but there were one or two that were quite good. What do you think? Are you impressed with their new material? --------------------------------------------------------------------------------?Silence silly mortal!? He boomed. ?I am Gobshet!??Sure you are.??Torture him at once.??Have a nice day at the gym???Pull out his teeth and then cut off his nose.??My nose? What?s my nose got to do with anything? Sure, I won?t be able to smell this stinking place.??You smell Mortal. You smell of ritual berries.??That?s probably because I have been eating them.??You stupid mortal. Always eating other peoples things.??You don?t know the half of it. Whoever?s cave it was, Hazel ate the stew. I didn?t know Goblins liked stew.??Find this Hazel at once and cut off its tongue!??Don?t! Leave her, kill me instead!?
  21. I'm usually very well a creating a problems and then finding a solution. However this time I'm stumped.I'm attempting to create timers.. I know this is possible by doing... visual basic code:--------------------------------------------------------------------------------Option ExplictDim WithEvents tmrTimer1 As VB.TimerPrivate Sub Form1_OnLoad()Set tmrTimer1 = Me.Controls.Add("VB.Timer", "Timer1")End Sub--------------------------------------------------------------------------------Now, what I need is to be able to create those timers, but creating them so they belong to an array of timers.Any ideas, hints, suggestions...???__________________' Comments go here...
  22. Hello FriendsI have heard not heard anything about Delphi...But its name is very Cute (Delphi its like Dolphin )I want to know What type of application we can make in Delphi, I mean to say is it use for Desktop Application ? or Server Side Application ? or it is like C#, or Perl ?? Whats its advantages ??? How its different from other Languages ??Why we have to use Delphi ??? What is the Major Different in comparison with other languages ?What is the future of Delphi ??? Please Answer me if anyone can !!!
  23. Not so long ago I heard someone say they prefer music played by live rock bands and not electronic dance music. They said they prefer ?more tuneful tunes?. What the hell does that mean?I find that many people put down dance music feel that any music not made with real instruments is easy, that anything made on a computer or software like Pro-Tools couldn?t possibly be anywhere near as credible or skilful as music made with real, live instruments. Do you find this to be true?There is so much absolutely beautiful, moving and ?tuneful? electronic music out there. So much of dance music is cutting edge in its sound, there?s something distinctly fresh and evolving with its beats and its melodies; to me electronically made music seems to be burgeoning on an ever expanding future of discovering new sounds. To me the computer is an instrument in itself; able to create new sounds that cannot be made with live ?analogue? instruments.So is there any truth to the opinion that electronic dance music isn?t real music? Is the credibility in the making of the music or in its sound?
  24. I have read the 'interview' before and find it even more amusing since I have been hard at work to become a C++ expert. It appears quite plausible to those who are new to C++ (either from C or some other language) that many of the elements of C++ were expressly invented to confuse and confound, but I find that the larger the project I work on the more valuable C++ becomes (really, any OO language, but I am performance oriented so C++ is my favorite). It is quite possible to build large projects in C (the original C++ 'compiler' was just a preprocessor to create plain C code for existing compilers), it is just that C++ scales more cleanly and takes less expertise on the programmer's part. I particularlly like C++'s ability to drop down into C (and even asm, though I often go to self-modifying code when I go that low) to manipulate constructs (something you generally don't get with Java or most other OO languages). Dangerous? Very. However, when you need it, you need it and it sure beats the hell out of trying to learn how to 'escape' to another language when you do need that power. There are quite a few compromises in C++ due to the focus on backward compatibilty, and many people fault that, but if it were not for that 'feature' C++ (or whatever it would have been called) would probably be a niche product instead of one of the mainstream languages it is today.
  25. Hey, all.Hope someone can make some useful suggestions, as i'm pretty much at a dead end!I'm writing some code to run in a win32 envrionment, using the API to interface with audio hardware. At the moment this is very simple, and I'm pretty much just regurgitating micro$oft tutorials. I'm using the Bloodshed Dev-C++ compiler.My problem is this -- i'm trying to use the CWaveFile class to provide a simple interface to .wav files. This class is defined in DSUtil.cpp, and makes use of the 'standard' mmio functions. To use these, I have to #include the mmsystem.h library, and link to the winmm.lib library; both of which I have done.However -- when I try to compile, I get linker errors referring to the mmio functions, saying things like ' [Linker error] undefined reference to `mmioWrite@12''I've no idea what else i'm supposed to link to/include; and there doesn't seem to be anything either on the web or on MSDN to clarify things further.Anyone had any experience of this?Best regards.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.