432 Posted Topics
As my project is growing, i've found myself needing to employ a new thread to carry out a loop task for the lifespan of my program. It all works seemingly well except for when I exit it. It dosent close cleanly. By that I mean I have to press SHIFT+F5 … | |
Re: I'm quite the novice but are chars not just unsigned int values anyway? for example... char c = 0x41; // A cout << c <<endl; getchar(); | |
Re: I'm not entirely sure what your goal is from your words. So this is a guess. int main(){ int arr[10]; int *ptr; int i; ptr = arr; printf("Enter 10 integers:\n"); for (i=0; i<5; i++){ printf("arr[%d]: ", i); scanf("%d", ptr); ptr++; } for (i=4; i>=0; i--) { ptr--; printf("arr[%d] = %d\n", … | |
Re: Is that just a random piece of code you found? In your code proper. `cout << "Your name is: " << firstmame[0] << "." << surname << endl;` | |
Re: Here at daniweb, you're expected to make an initial effort, and pose relative questions. | |
Re: I cannot imagine you could not find the first link in a google search. http://en.wikipedia.org/wiki/Unistd.h Also, if you don't know what it is, you don;t need it. | |
Re: Should you not be working with wstring and wchar_t types? | |
Re: Do you have a query? Include problem and errors, as well as any questions. | |
Re: do those includes not require quotes rather than angle brackets? | |
Re: Try adding to main.cpp #include <iostream> using namespace std; If not solve issue, tell what Compiler/IDE and OS/Version you use. | |
Re: Don't know if thisa is best way, but appears to work for me. #include "stdafx.h" #include <iostream> #include <cctype> using std::cout; using std::cin; using std::toupper; char firstname[15], lastname[15]; int main() { cout << "Enter your last name: " ; cin >> lastname; cout << "Enter your first name: " ; … | |
Re: isupper is failing, vs2010 same error. isctype.c #if defined (_DEBUG) extern "C" int __cdecl _chvalidator( int c, int mask ) { _ASSERTE((unsigned)(c + 1) <= 256); //<<<<<<<<<<<<<<<<< here return _chvalidator_l(NULL, c, mask); } does it expect unsigned char? | |
I am wrapping the Windows API CreateProcess. Here is my code. int __stdcall _Execute(LPTSTR program, LPTSTR workingdir, WORD show){ // Check if program has content if (!program || !*program){ MessageBox(NULL, L"You must provide path to executable", L"Error", MB_OK); return 0; } // Create buffers and copy program param to szCmd … | |
Re: Can't test at the moment, but try this. #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, const char * argv[]) { char name[10]; int x = 0; //get user input of name printf("Enter your name: "); scanf("%s",&name[10]); printf("Your name has %lu letters.", strlen(&name[10]));//Length //Having problem over here I need … | |
Re: Thanks for letting us know. Post your code if you get stuck. here's a quick example of what a) could be. double _a(double A,double B,double C,double D,double E){ return A + B + C + D + (E / 5); } | |
Re: Sure it can, but it would be better, quicker, and of more value to you, if you wrote your own from scratch. | |
Re: You could count the spaces, and add 1. That's assuming there are no leading or tailing spaces. | |
Re: You forgot to mention you are a C beginner like in your other 4 threads. I would advise you not take on such complicated projects as a beginner. If you choose to do so anyway, then it's best to post the code you have tried. | |
Re: What is is the output on the screen when you compile and run that code? | |
Re: Yes, pass string in quotes as you have above. | |
Re: In your screenshot, no name has been entered. | |
Re: Can get you started... #include <iostream> You're going to need a "main" function. cin. cout. and a bit of mathematics. | |
Hi, I am currently writing a library for dynamic use, and in it I have some string functions. This particular one returns a substring of a given string from the rightmost, determined by a given count. I just get the feeling that I'm missing some error checking and would like … | |
Hi daniwebbers. I've been hearing a lot about Qt when searching for a library to ease my pain of creating GUI's with native windows API. I'm hoping folks here might be able to offer some sage councel before I do something irreversible to my IED environment (vs 2010) that I'll … | |
I'm attempting to automate work on an external webpage. One particular element refuses to respond unless the mouse cursor is above it, which means the automation fails. I have tried firing events such as onmouseover, onmousedown etc.. but nothing appears to work unless the system mouse cursor is above the … | |
Re: Is standard library present in your install? | |
Re: Create a string array similar to below `std::string sArray[10][3];` Use cin or similar to populate the elements of that array. Post here, your attempts. | |
Re: Have you accomplished this task in 'AutoIT'? If you have show the code. | |
I found myself needing a threadsafe global variable to indicate when a thread is complete. Quickly discovered `std::atomic<type> var(val);` only to find it has no support in my IDE. Can anyone offer an alternative? I have an operation that needs to be carried out which takes some time, I cannot … | |
Re: What does the documentation tell you the parameteres for `scanf_s` should be? | |
Trying to put inline functions in external file within project, and getting below errors. If I remove "__forceinline", then all is well. If I have the inline function in main cpp file and not in header, it is fine also. Is there a procedure to deal with this? file.h __forceinline … | |
Re: As an occasional visitor to daniweb, I have to say I never even noticed a change in software, and thought that popup think when posting was just an addition. What I have noticed in other places I visit regularly is that activity drops come spring/summer time. Whether that contributes to … | |
Re: There are are many examples of brute force methods here in the forums. Just put "Brute force" into search field. | |
Re: > In object-oriented programming, a friend function that is a "friend" of a given class is > allowed access to private and protected data in that class that it would not normally > be able to as if the data was public. http://en.wikipedia.org/wiki/Friend_function | |
A short while ago I was intrigued by a reply made by nullptr in [this thread](http://www.daniweb.com/software-development/cpp/threads/458583/shellexecuteex-api). So I began to look for ways to access the rest of IE (IWebBrowser2) interface, and met limited and varied success. Accessing for instance a <div></div> element in a wep page html document was … | |
Re: There are no infinate loops in that code, it would be best if you could show the relevent loop. | |
I'm trying to embed a window into my own. I somehow new it would not be as simple as it sounded, so I'd like a pointer where else to look if anyone can help. hMyOwnWindow //HWND hExternalWindow // HWND //size the external window so it will fit. MoveWindow(hExternalWindow,19,102,383,400,true); //set style … | |
I'm running this code. SHELLEXECUTEINFO ExecuteInfo = { 0 }; ExecuteInfo.cbSize = sizeof(ExecuteInfo); ExecuteInfo.fMask = 0; ExecuteInfo.hwnd = nullptr; ExecuteInfo.lpVerb = L"open"; ExecuteInfo.lpFile = L"C:\\progra~1\\intern~1\\iexplore.exe"; ExecuteInfo.lpParameters = L"http://www.google.co.uk"; ExecuteInfo.lpDirectory = nullptr; ExecuteInfo.nShow = SW_SHOW; ExecuteInfo.hInstApp = nullptr; ShellExecuteEx(&ExecuteInfo); Sleep(5000); CloseWindow((HWND)ExecuteInfo.hwnd); exit(GetLastError()); It's not closing the window. And it's exiting with … | |
Re: To be honest I'm having trouble making any sense of the code, but I would suggest that what you are outputting is the decimal values of the characters contained in processTheseThree. | |
When I visit a section of the forums and look at a single thread, when I return to it's index page all threads are marked as read. Anyone have a solution to this? | |
Re: I'm not entirely certain of your goal from your post, or the platform on which you work. But I'm using windows, and would start with the WINAPI [EnumThreadWindows](http://msdn.microsoft.com/en-us/library/windows/desktop/ms633495?v=vs.85.aspx) | |
Hi. Parden me if I do not express my question very well. A project I am considering would benefit greatly from the ability to to compile a dll at runtime, on machines which may or may not have appropriate tools installed (so I may be looking at using third party … | |
Re: In windows API you can use [GetPixel](http://msdn.microsoft.com/en-us/library/windows/desktop/dd144909(v=vs.85).aspx)(...) function. | |
Re: > i just dont know how to insert the "arp" two times in a single string Insert in once, and then insert it once. | |
Hi. In a project of mine, I have many different files 1.h, 1.cpp, 2.h, 2.cpp, 3.h, 3.cpp etc. Some of the functionality in them depend on veriables or functions in the others. If I juggle the #includes around I can get around most of it, for instance, if functionality in … |
The End.