- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
37 Posted Topics
I am a beginner with win32 programs, and am trying to integrate my console into a window. My console program starts a new thread which creates a window. [CODE]DWORD dwThreadID = 0; HANDLE hThread = CreateThread(NULL,0,ThreadProc,argv[0],0,&dwThreadID);[/CODE] i want to create a miniature output textbox within my window, which reads the … | |
Hey, so im making this game, and at the moment im using PlaySound() which is a function of windows.h to play my sound files. Ive got a problem though, i now want to be able to play more than one sound at the same time, and only now do i … | |
Re: similarly for me, written by my own fair hand.. [CODE]string removewhitefrom(string full) { char x; int counter = 0; string processed; for (int t = full.size();t > 0; t--) { x = full.at(counter); if (x != ' ') { processed.push_back(full.at(counter)); } counter++; } return processed; }[/CODE] | |
Hey, does anyone know which function/s i need to use to copy a file from one subdirectory to another, without changing the name? im on windows if that helps. | |
Id like to have my console program stopped and code executed if a timer runs out. does this mean i need another thread? can anyone point me to some functions i may need to use as ive never forked a program before. im using visual c++ on windows. | |
Hey, ive got a problem. i cant seem to get Playsound() to work. Ive searched google, and alot of people say to go to properties - all configurations - linker - and add winmm.lib to the additional dependencies to link it. ok, so i did that, have included mmsystem.h, but … | |
[CODE]if ( initialize == "off" && Iminor > 20 || Imedium > 10 || Isevere > 5 || Ifatal > 0 )[/CODE] the string type 'initialize' is cout'ing "on" and all of the values right of the AND operator are TRUE. Why is the subsequent code block for the if … | |
[CODE]int thetime = time(NULL); string in; stringstream out; out << thetime; in = out.str();[/CODE] that's my code for casting an integer into a string, but im having a little trouble reversing it to change a string into an int. :/ can anybody help me out? you have to include the … | |
Hey, ive got two string types [CODE] string string1 = '1'; string string2 = '2'; string string3 = string1 + string2; [/CODE] Ok, ive simplified my code. I would like string3 to equal '3', and not '12'. I dont know anything about casting. Please dont tell me to use an … | |
Ok so ive written a console program which is great, and now i want to create a thread that makes a window (winAPI) and can commuunicate with the console window. Well to describe it properly, i would like the window thread to send predetermined text (by clicking buttons) to the … | |
Ok, so ive had this really annoying problem with Visual C++. It bugs me because it doesnt make any logical sense. something i guess we need to program. Anyway, Visual C++ reckons that the datatype "string" isnt defined, even though it is in the included library string. If i right … | |
Re: thanks for fixing this problem, it was quite surprising, really | |
Re: david is correct. Also you are trying to use Total_Number_of_Seconds before it has been initialized. Fill the variables after you have the value to fill it with, not before. | |
Im trying to learn how to use the winapi - ive read tutorials about message handling and the windows procedure ect, but am a bit lost as to where to start. I know what i want to do - my program launches as a console and starts a new thread … | |
Re: please wrap your code in code tags and repost, i can't read that. | |
Re: yeah i think a shell script would do the job. Hamilton C shell was developed for windows. i cant be more help in that respect - ive never written a shell script. What about system()? cant you use that to run your compiler? | |
Re: I've done this before. do you want it to take a specific line or just have it return the first and only? This is the first version of my function. i have another that can return the line only if it starts with a specific substring [CODE] string getfile(string file, … | |
Re: That sounds like a fun challenge. here is your code: <<snip>> | |
i wrote this a couple of years ago when i was just starting to program. i didnt know any professional programmers and wanted to learn, so just experimented with the language. maybe it will give you an insight into how people program for fun. feel free to add to it, … | |
Re: i totally agree with appropriate variable naming too. i far too often find myself stuck debugging only if i had just used better variable names the problem would be easier to isolate. It also helps other people read and understand your code when you ask for their help. | |
i have a string which is giving me problems. when i put it into a textfile, it puts the cursor onto the nextline. i assume because there is a \n at the end of the string, but when i cout the string, the newline character isnt there (well, the console … | |
i would never ask for debugging help usually but i am totally lost and have wasted far too much time on this. both peices of code compile correctly. the original function works fine with my program and the second one crashes. the original code checks a textfile in the root … | |
Re: the string library is amazing. create an array of the size of the string then loop through the string and copy each element into the array [CODE] #include <iostream> #include <string> #include "windows.h" using namespace std; int main() { string imastring = "i am a string"; char array[imastring.size()]; for (int … | |
Hey guys. Im writing a console based application which i want to convert to a windowed application. however, i still want the user to be able to type in input and for my program to be able to output in a console based style, i'd just like the option to … | |
Re: a for loop is very useful. It will loop through the code contained within the curly braces. [CODE]for(::) { cout << "loop"; }[/CODE] there are three sections that control the for loop. for(1:2:and 3) 1. You tell the for loop to use this variable to control it. you can either … | |
Re: [CODE] 1. int main () 2. { 3. . 4. . 5. . 6. . 7. 8. 9. ifstream file1; 10. ifstream file2; 11. ofstream simiralities; 12. simiralities.open("P(0)_P(1).txt", ios::app); 13. file1.open("test1.txt", ios::in); 14. // A good way to check if a file has been opened- if (! file1) { cout … | |
id like to write a function that checks if an object's variables have been changed. the only way i can think of is to create a duplicate object and compare each variable. im really lazy, and this seems like alot of effort. can anybody help me think outside the box? … | |
Re: Ive only ever used one book with c++ [url]http://www.amazon.co.uk/Programming-Easy-Steps-Mike-McGrath/dp/1840782331[/url] its dirt cheap & covers most topics. I only use it for reference though, i think you can only really learn c++ properly by messing around with it. :) | |
Re: I use a mixture of both, if you stick a "\n" in a file it will put the next bit of data on a newline. I think endl is just for console output. its probably good to get used to using "\n" as there are other escape sequences too, like … | |
Re: You are going to have to look into socket programming i think. ive never done it myself, so i cant really say much on it, but i think its dependent on the platform you're using. | |
Id like to edit a file. At first i thought this was going to be easy, but now it appears quite complex. As i understand it there is no standard way to delete part of a file? im storing data on different lines in the file, and want to target … | |
Im having some problems organising my code in a large (for me) project. Basically my problem stems from having 1400 lines in one source file. Ive written 38 functions which all have declarations above the main function. Below my main function block i have all of the function definitions. Im … | |
Hey. I have to say this is the first time ive been totally stumped by c++. I cant exit this loop. this code is from a function that takes a string filename, an int mode, and a char print. It takes a textfile looking like this: somesite.netinfoaboutsomesite someothersite.orgdataonsomeothersite yetanotherrandomsite.edurandomchars and … | |
Im developing software that will handle alot of files & i was wondering what the best way of doing this is. There's a couple of things that are important. 1) i want to be able to access the files easily and have them grouped. 2) i want the files to … | |
Hello! google has turned me up at this forum so many times i think it would be stupid to ignore the hints & not get registered! Im having some problems with objects. Here is my code: [CODE]#include <iostream> #include <string> using namespace std; class planet{ public: int moons; int mass; … | |
Re: At the end of your cout << i++ << endl; end1 should be endl. it ends the line & puts the cursor on the next line. your compiler should give you the line of the error to make them easier to find. |
The End.