15,300 Posted Topics
Re: >>while(desktop = NULL); That will produce an infinite loop because you want to use the boolean == operator, not the assignment = operator. And what's the point of those do loops anyway? If FindWindow() returns NULL the first time it will always return NULL. Calling FindWindow() again isn't going to … | |
Re: you can not just typecase from char* to wchar_t*. You have to call one of the transformation functions. This works ok for me when the program is not compiled for UNICODE [code] #include <iostream> #include <cstring> using namespace std; int main() { char S1[] = "C:\\Program Files" ; char S2[]= … | |
Re: you have to use some of the [URL="http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx"]Windows Console[/URL] functions. But they are not available if you are using an ancient 16-bit compiler. If that is true then upgrade to a new free 32-bit compiler, such as Code::Blocks or VC++ 2008 Express. | |
Re: 1. Read the value at that registry setting. If you are using non-managed code (normal c++) then you can refer to any of [URL="http://www.google.com/search?hl=en&rlz=1G1GGLQ_ENUS328&q=windows+registry+c%2B%2B+tutorial&btnG=Search&aq=f&oq=&aqi="]these links[/URL] for more information. 2. Assuming it is a path to a file, just use standard C function remove() to delete it. 3. You will also … | |
Re: Here is one way to retired the output of that program to a file. If all you want is to get it into your program then do the same thing here buf save the strings in an array or vector<string> [code] #include <stdio.h> #include <iostream> #include <fstream> using namespace std; … | |
Re: add something to the end of the program that makes you enter a key, such as cin.get() -- btw the problem is your program, not the IDE. | |
Re: Use which ever language you like the best. If you download the DirectX SDK from M$ it contains several example programs and I think they are written in c++. >>Also is the mouse in windows written in c or C++? There are no win32 api functions written in C++. M$ … | |
Re: [QUOTE=krishnampkkm;895587]Hiii [B] How to use SHFileOperation() ?[/B] u have any direct link to it... thanking u..[/QUOTE] You mean like [URL="http://lmgtfy.com/?q=+SHFileOperation"]this one[/URL]? | |
Re: The site has been very slow for everyone today -- I even got database error messages a couple times. | |
Re: this is not a C program because it includes iostream.h, which is an old obsolete file. | |
Re: Possibly lack of code guards is the problem. [code] #ifndef MYHEADER_H #define MYHEADER_H // other stuff here #endif [/code] [edit]what ^^^ said [/edit] | |
Re: you could use standard C function qsort(), c++ std::sort(), or write your own sort algorithm. | |
Re: you could use stringstream class in <sstream> [code] string sentence = "Now is the time for all old folks to be in bed"; string word; stringstream str(sentence); while( str >> word) cout << word << "\n"; [/code] | |
Re: you don't need a loop or switch statement. use string's substr() method to extract the first two characters and again to get the last two characters. | |
Re: what code are you talking about? | |
Re: You have to compile all programs for release mode before attempting to run them on other PCs. The DLLs you mentioned are for debugging on your PC only with your compilers. | |
Re: you can use the macro isdigit() to find out if it is '0' to '9'. And the At() method is unnecessary. [icode]if( isdigit(word[i]) )[/icode] | |
Re: I think it doesn't know what [b]string[/b] is, and I don't think you can pass string objects as parameters to COM functions. Change [b]string[/b] to [b]char*[/b] and see if that fixes the problem. >>What does "in" mean in your function by the way? In COM programming there are [b]in[/b] parameters, … ![]() | |
Re: Have no idea how to help you because I don't know what Multiply() and Power() do. And that is one of the weirdest programs I have seen in a long long time. [b]program_body[/b] instead of [b]int[/b] ??? Only a university professor would dream of writing such confusing and unconventional crap. | |
Re: Attempting to compare a single character with a string. Here is how to fix it -- use single quotes instead of double quotes [icode] array[i][0] == ' '[/icode] | |
Re: do you want ms-windows or *nix? Sample code for both [URL="http://www.daniweb.com/code/coder46588.html"]are here.[/URL] | |
Re: open first input file A open output file read input file A (probably use fgets() ) write to output file (using fprintf() or fputs() ) close input file A open input file B repeat the above for B close both files and you are done :) You need to study … | |
Re: There is no such concept as HttpSession in c++. When you logon in java I presume the java code checks a database, such as MySQL, for login credentials. If username and password are verifyed then the user is allowed to continue using the program. C++ programs can do the same … | |
Re: [QUOTE=Tom Gunn;894029]. "rt" isn't portable.[/QUOTE] Whatever gave you that idea? True, text mode is the default, but there is nothing wrong with specifying 't' in the mode string. If there was then it would be in the c standards. | |
Re: I assume you mean in MS-Windows operating system. You would not want to do that even if you could because it would not allow the user to easily select a different desktop icon, the start menu, or any of the icons in the desktop trey. And that would piss off … | |
Re: Are those four different integers? Looks like a normal text file to me, not a binary file. If it were binary file then you wouldn't be able to read those integers. Try this: [code] int x; infile.read( (char*)&x, sizeof(int)); [/code] or this [code] char* buffer = new char[4]; infile.read(buffer, 4); … | |
Re: There are several ways to accomplish that -- functions in stdio.h or iostream. For example: [icode]cin.get()[/icode] | |
Re: Reading that file is not difficult as long as the records are separated by '\n' or '\r\n', depending on the os. The code below will read each line then split it up with the semicolons as deliminators. [code] FILE* fp = fopen("file.txt","r"); char buf[255]; while( fgets(buf,sizeof(buf), fp) != NULL) { … | |
Re: [QUOTE=niek_e;893568]I almost flagged this thread as spam due to the enormous amount of iPod spam posted on daniweb lately :)[/QUOTE] And I was about to delete it :) | |
Re: Start [URL="http://lmgtfy.com/?q=enumerate+network+connections"]here.[/URL] ![]() | |
Re: [QUOTE=gwen73;893261]I am sorry but I do not know how to use code tags [/QUOTE] Then you are not paying attention. You had to type right over the instructions when you typed that post. The instructions are also provided when you signed up, and again at the top of every DaniWeb … | |
Re: You need to use function pointers. Here is a simple example where you type the name of the function you want to execute at the keyboard. Since C and C++ and not interpreted languages you can not execute code that has not already been compiled in the program. [code] #include … | |
Re: >> static int code,a,c,p,m,d,e,h,f,z; You forgot to declare [b]code[/b] globally like you did the others | |
Re: >>Any advice or tip will help out. Thank you Your program contains hard-coded data, but the requiremenets state it must read the data from a data file. That's the first thing you need to do -- get that working first then continue on with the next item in the requirements … | |
Re: >>wsprintf Are you compiling this program for UNICODE? If not, then why are you calling the unicode version of sprintf()? I know this doesn't answer your question, I don't know the answer. | |
Re: change "%u" to "%p" and rerun your program. Also, the way to insure there are no holes in the structure is to use the [icode]#pragma pack(1)[/icode] [code] #pragma pack(1) struct emp { int age; char name[6]; } e; #pragma pack() int main() { printf("%p\n",&(e.age)); printf("%p\n",(&(e.age)+0)); printf("%p\n",(&(e.age)+1)); printf("%p\n",(&(e.age)+2)); printf("%p\n\n\n",(&(e.age)+3)); printf("%p\n",(&(e.name)+0)); printf("%p\n",(&(e.name)+1)); … | |
Re: >> Carlist.Cost[i1]= Should be [icode] Carlist[i1].Cost= ...[/icode] | |
[url]http://www.break.com/index/dont-drink-and-go-cart.html[/url] | |
Re: you could do this: Also, its not necessary to surround function calls with parentheses. [code] int main(int argc, char** argv){ [color=red] char sdsd[] = "asf/asdf";[/color] printf("%s\n",sdsd); fix_name(sdsd); printf("%s\n",sdsd); return 0; } [/code] | |
Re: since ptr2 is a reference to ptr1, when you change ptr1 the change is also reflected in ptr2. What you can't do with ptr2 is assign a new value to it like [icode]*ptr2 = 2;[/icode] is an illegal statement because ptr2 is a const. | |
Re: >>reinterpret_cast is the recommended way over anonymous unions. reinterpret_cast is not allowed in C. So I don't know where you got your information but its wrong. The only place I've used anonymous structs is inside a union [code] union something { struct { int x; int y; }; unsigned char … | |
Re: compile both for debug and use your compiler's debugger to find out the problem. Does your program use LoadLibrary() to load the dll into memory? Then GetProcAddress() to get pointer to a function? Make sure that function pointer is not NULL. | |
Re: [QUOTE=mimi_ted;891611]hi everybody. i need to to know where to start developing my hard ware knowledge. mimi[/QUOTE] In school. And Welcome to DaniWeb. | |
Re: All versions, including the Express edition, has Windows Forms. To start a new project click File --> New --> Project --> CLR, then in the Templates window click Windows Forms Application >>BTW, I am actually going to buy one of these versions but the pro edition is a bit pricy. … | |
Re: post an example of the input string because I don't have a clue what that code (lines 23-39) is attempting to do. | |
Re: Ubuntu may be ok for just casual users, but is terrible for c/c++ programming. I tried it on my computer, easy to install but does not include any developers tools such as GNU compilers. I now use fedora 5 which is a lot more complete. Don't know anything about the … | |
Re: Is the file more than 2 gig in size? Can you replicate the problem using the same file with a program that just calls those two functions? | |
Re: There is an error in the airport1.txt file on line 90 [icode]SYD BNE 07:30 1:00[/icode] getline() reads it in as [icode]SYD BNE07:30 1:00[/icode] -- missing the space between BNE and 07:30. I re-typed the line and the program continued to work from there until the next error, which was at … | |
Re: It would be helpful if you told us which line the error occurred on so that we don't have to read the whole program to find out. |
The End.