15,300 Posted Topics
Re: >> if (argv[2] = "SC") You can't compare character arrays using the = operator like you do VB. Use strcmp() function prototyped in string.h header file -- or <cstring> if you prefer. [icode]if( strcmp(argv[2], "SC") == 0)[/icode] | |
Re: This opens the directory, gets the directory size ok, but fails to read the directory. I don't know what can be done with the handle. [code] #include <windows.h> #include <iostream> #include <fstream> using namespace std; int main() { HANDLE hFile = CreateFile("C:\\users", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); if( hFile … | |
Re: Its an infinite loop because the value of y never changes. >> x=static_cast<int> (y)%10; The cast is unnecessary because y is already an int, and y%10 is also an int. And why is d_a a double? Why not just enter the binary digits as an integer? (unless of course that … | |
Re: >>'m having trouble unzipping it on Linux. are you using gzip ? | |
Re: The password can not be verified, probably its just a fake username and password in the code your posted. You need to provide a valid user name and password -- but do NOT post them here. | |
Re: After entering an integer you have to flush the '\n' <Enter key> from the keyboard buffer. The easiest way to do that is [icode]cin.ignore(1000,'\n');[/icode]. Read [URL="http://www.daniweb.com/forums/thread90228.html"]this thread[/URL] for more details. | |
Re: [code] static const char * sql_backslash_to_underscore(const char * key) { if (!key) { ERROR0("got NULL key"); return NULL; } char * dup = strdup(key); char* ptr; while( (ptr = strrchr(dup,'\')) != NULL) *ptr = '_'; return dup; } [/code] One problem with the above code is that the caller cannot … | |
Re: [QUOTE=Birendra Dhami;889470]sir how can i add two fraction nos. to get again fraction eg. a/b+c/d=(ad+bc)/bd I would be very happy if u send me code.[/QUOTE] We are not in the business of doing homework free of charge. Add $1,000.00 USD to my pay pal account and I'll do it for … | |
Re: Never tried it myself, but maybe [URL="http://www.dreamincode.net/forums/showtopic35141.htm"]this thread [/URL]will help you. It contains some source code to call the GetPixel() function. | |
Re: why don't you just use one of the platform independent GUI 3d party libraries, such as [URL="http://www.wxwidgets.org/"]wxWindows[/URL], [URL="http://www.gtk.org/download.html"]GTK+[/URL], or [URL="http://www.qtsoftware.com/products/"]QT[/URL]. I think wxWindows and GTK+ will both work with VC++ 2008 Express (although I have not tried it). QT is its own IDE which works with nearly any 32-bit compiler. | |
Re: [QUOTE=jephthah;888540] fgets will return [I]everything[/I] up to and including the newline. But the problem is, that a newline character's ASCII representation is system dependent. [/QUOTE] Not in memory -- its always '\n' regardless of the operating system. Its just the file systems on physical hard drives that are different from … | |
Re: >>while (in >> str) out << str << "-"; What??? That will not replace white spaces with '-' character. [code] while( in >> str) { for(int i = 0; i < str.length(); i++) { if( isspace(str[i]) ) str[i] = '_'; } out << str << "\n"; } [/code] | |
Re: I don't drink coffee -- no option for that either, so I stopped at the first question. | |
Re: Those C functions may not work with huge files -- files that are larger than 2 gig. In MS-Windows win32 api functions would be needed to get the file size of huge files. I don't know about *nix or MAC | |
| |
Re: Welcome to Daniweb. Please post your question in the appropriate forum. Narue has written a detailed explanation in the C++ board about how to flush the input stream in c++ programs. See the sticky in that forum. | |
Re: If you want to reference header files in all your projects then select Tools -->Options --> Projects And Solutions --> C++ Directories, then add the paths in the window on the right side of the screen. After that all you have to do is something like [icode]#include <dm/something.h>[/icode] if the … | |
Re: [quote]Probably not more than one in a thousand could name more than a couple of the MEPs we sent there last time. [/quote] Its like that here too. Very few American's can name the people in our Congress and Senate. Sure I know the names of a few, but all … | |
Re: I believe both -- God created everything, how he did it was through evolution. | |
Re: That operating system and compiler are you using? In my MS-DOS 6.X days I had no conflicts between serial port interrups and printf(). I just wrote a serial port driver (supported 1 to 40 serial ports) that was TSR and the rest of the program ran normally, within the memory … | |
Re: So the implementation code for the class is in the application program and not the DLL? Sounds backwards to me, and when compiling the DLL it is not possible for the compiler to resolve the class references. I think you need to redesign something and put the class implementation code … | |
Re: >>If you would just give the code I may add up some features Exact code will depend on the operating system. Setting the time/date is quite simple -- just look up the time functions for the operating system. | |
Re: Welcome to DaniWeb :) We have quite a few members who are from India, including one of our moderators. Hope you enjoy your stay. | |
Re: IMHO c++ for dummies is exactly that -- for dummies. There's an entire thread at the top of this forum about c++ books, you should read it. For MS-Windows program all you need is a fundamental knowledge of C or C++ language. The win32 api does not require c++. [URL="http://www.winprog.org/tutorial/"]Here … | |
Re: There is no such thing as space that is absolutely empty. space by definition contains something. And in a vacuum there is no space. | |
Re: >>I do not understand what is happening here Microsoft completely rewrote CString to convert it from a c++ class in VC++ 6.0 compiler to a template in VC++ 2005 and later compilers. There were lots of changes to MFC, and CString was just one of them. Consequently you may have … | |
Re: [QUOTE=Usura;886109]could someone please point me to a link on how to convert my char* temp = new char[3]; to a char test[3]?[/QUOTE] Post code. Generally we would not allocate just 3 characters because it isn't worth the effort. But, like everything else, there are exceptions. | |
Re: I know of one library, but I don't know if it would fill your needs. [URL="http://www.datareel.com"]DataReel[/URL] This library contains a lot of code, but also client/server sockets with sample programs. | |
Re: try putting two colons in front as shown in[URL="http://msdn2.microsoft.com/en-us/library/system.windows.forms.messagebox.aspx"] this example[/URL]. | |
Re: lines 37-80: That is c++ code, not C. Are you writing a C program (afterall this is the C forum) or a c++ program ? | |
Re: [QUOTE=amrith92;873921]Are you sure that this program compiles? You seem to have used [ICODE]string[/ICODE] in your code, but you haven't included [ICODE]<string.h>[/ICODE] at all...![/quote] That's because std::string is not declared in <string.h> -- its in <string> header file. And some compiler include <string> with <fstream> | |
Re: how about this: [icode]return (d-1) < 0 ? North : d-1;[/icode] No need for the mod operator. | |
Re: Moved to C forum because it is a C program, not c++. >>fflush(stdin); Non-standard use of fflush(). There is no standard way to flush the input stream, and fflush() is only defined to flush output streams to the file on disk (e.g. your hard drive). | |
Re: Here is one way to do it -- uses a vector of structures instead of individual arrays. [code] #include<iostream> #include <sstream> #include <string> #include <vector> #include <fstream> using namespace std; struct person { string name; float weight; string location; string color; }; //inside main int main(void) { vector<person> people; string … | |
The lady that made an ass of Simon Cowell! What a talented woman :) :) [url]http://www.youtube.com/watch?v=RxPZh4AnWyk&NR=1[/url] I've watched that clip 5 or 6 times and am amazed each time I watch it. | |
Re: >>memset(wText,0,len); That only sets the first half of the buffer -- what you want is [icode]memset(wText, (len * sizeof(wchar_t));[/icode] >>should I create a new pointer to convert from the unsigned char[]? No, just typecase it: [icode] int len = strlen((const char *)in)+1[/icode] | |
Re: Why are you bothering to count the number of integers in the file before actually reading them into the array? Your program doesn't do any dynamic allocation of the array, so what's the point of doing that? Just put the data in the array the first time the file is … | |
Re: The code marked in [color=red]RED[/color] is for the menu item [b]statistics[/b] and I have no idea what that's supposed to do. >>Also can you tell me how to make a new menu item "DELETE MARK" See the function do_again(). Just add another menu item to what's already there and you … | |
Re: [QUOTE=csurfer;883926] P.S: Guys the person "san gabriel" doesn't know about string classes I suppose may be new to c++ so wouldn't the new info be better?[/QUOTE] No, at least not for the purpose of his assignment. He is probably learning about character arrays, not c++ STL classes. | |
Re: hiscasio: also tell us what compiler you are using. And are you on *nix, MS-Windows, or something else? | |
Re: Did you select menu Build --> Build Solution? You have to do that before doing anything else. | |
Re: >>is there a difference between call by reference and pass by reference?? No. They both mean the same thing. | |
Re: Thanks for posting those links -- I've been wondering where they went. Made this thread sticky so that it stays where we can easily find it. | |
Re: you really don't need to use strtok() for this problem. All you need is strchr(). First locate the ')' charcter, copy that to areaCode character array. Then find the '-' character, copy that to exthange character array. Finally copy the remaining characters to the ext array. If you know how … | |
When I click a link IE8 always opens a new window instead of creating a new tab. I have clicked Tools --> Internet Options --> Tabs --> "Open Link In Other Programs In" --> "A new tab in current window". How can I set it so that a new tab … | |
Re: [quote]And what did Larson do with his money? He paid the taxes on his winnings ($35,000) and invested the rest, most of it in vacant land in a real-estate deal to build homes back in Lebanon. "It didn't work out," he says. "We had a cash-flow problem, and I lost … | |
Re: vc++ is the name of a Microsoft compiler, not a computer language. Is that what you meant? How to practice using the compiler: Just use it for some projects you can find anywhere on the net, including right here at DaniWeb. In addition to knowing how to create projects, you … | |
Re: >>values.erase (values.begin()); That should erase the entire array. Here is one way to print all the integers in the array [code] for(int i = 0; i < values.size(); i++) cout << values[i] << "\n"; [/code] Here is another way using an iterator [code] vector<int>::iterator it = values.begin(); for( ; it … |
The End.