186 Posted Topics
Re: There's probably 3rd party libs, but of course it can be done using APIs also. Include <mmsystem.h>, and link to the lib libwinmm.a (or equiv). Have a look at: [url]http://msdn.microsoft.com/en-us/library/ms713735(VS.85).aspx[/url] The functions (list shown in the left pane of above link) that relate directly to wave audio capture begin with … | |
Re: [QUOTE=Gusts;639720]So I got such exercise: You have array of 1000 elements they all are random numbers from 1 to 1000 and there is only one duplicate number. You can access each array member only once, can you find duplicate value? And you can't create another array. You can create some … | |
Re: for the current directory, no path specification is required. e.g. [icode]system(" start my_index.html");[/icode] should do. | |
Re: You can have a look at my definition for an xml parser. I've stored the contents of each tag/dir in an XmlDir class (which contains the tag name, a list of XmlDirs and a map of attributes to create a type of directory tree). The user interfaces are the public … | |
Re: You can't input a friend because there's an 'enter' key still coming in cin. use [icode]cin.get();[/icode] after the [icode]cin>>option[/icode] | |
Re: Is there any reason you can't just load your image of what you want to print (that you've created at 9600 dpi, 24bpp) into a graphics program, select print to-scale? You may have to turn a few image processing 'features' off if it's smoothing the image. I'm guessing that your … | |
Re: [QUOTE=gregorynoob;640921]okkkkay...so i tried... and failed. my code looks pretty fine to me (the numbering thing). could someone please take a look? thanks! [CODE] // check: for( int i = 0; i < X; ++i ){ for( int j = 0; j < Y; ++i ) [/CODE][/QUOTE] You've got this sequence … | |
Re: Assuming windows OS. #2, using SendMessage() can tell windows to do stuff. You could also use SendInput() to send keystrokes to the active window #3, if you can include conio.h, you can use kbhit() to check for any keystrokes, and getch() to get the keystroke #4, same way as for … | |
HI, I've written a big program which uses multiple serial ports and udp & tcp sockets. Everything works functionally as expected, but the serial port writes block until the data has been sent (reading is fine as I check the number of bytes available before trying to read). I thought … | |
Re: Doesn't impdef extract the .def file for you? so: "e:\>bcf\bin\impdef lt360lib.dll > lt360lib.def" will give you the .def file, then to make the import library (.a or .lib) use dlltool with the .def you just made, and the original .dll file: (see [url]http://mirrors.zoreil.com/webclub.kcom.ne.jp/ma/colinp/win32/tools/dlltool.html[/url]) | |
Hello, Does anyone know how to use _popen in windows xp sp3 (console application) to allow writing to a process? I've tried using _popen to read from a process. This works as expected. When I try _popen with write access, the process starts, but no commands are interpreted. My code … | |
Re: [QUOTE=Sukhbir;630219]Hi All, which is better if i have index of each element. [/QUOTE] if you have the index, using a standard array is faster in all cases where you can fit the whole array in memory. Maps are good for associated arrays (e.g. where the index is a string), for … | |
Re: [QUOTE=Kadence;627100] A related question - for int, is it the leftmost bit that holds the sign? And is it 0 for positive, 1 for negative, or the other way around?[/QUOTE] Correct, 1 for negative. See [url]http://en.wikipedia.org/wiki/Twos_complement[/url] for how it's done | |
Re: Reading is usually faster than writing for pretty much all non-volatile mediums (ROM, eeprom, flash (e.g. pendrives), harddisk, pen on paper, etc.). Most operating systems cache all disk access where possible - this makes writes appear much quicker (but not for large files), and makes reads heaps quicker (after the … | |
Re: I don't think you're allowed to call a variable '1d' or '2d'... You can pass the 2-D array as a int *, pointing to the first element. You have to calculate the location of the elements in the array in your function, e.g.: [code=CPP] void function(int *aaa, int r, int … | |
Re: member function string ip_uri(string ip50, string uri50); expects 2 string parameters, not 1 as you have given. | |
Hello, Does anyone know how to reduce CPU usage of a polling program running in Linux? The program is basically a polling loop that sleeps for a short period if there is no activity in that loop. On my system the select and nanosleep functions have a granularity of ~10ms … | |
Re: Both the member function declaration and definition will require the const modifier. This tells the compiler that the function is an 'inspector' function and will not modify anything in the object (which is required when using a const object). About your 'this' question, 'this' is a pointer to the instance … | |
Re: [QUOTE=arunpawar;601589]I have one more Big Question in this case is that "If i want to find out what value is input by user here,before printing it.How can i find out that it's integer or float?"[/QUOTE] You could store the user input in a string (instead of int or float), then … | |
Re: [QUOTE=Ancient Dragon;593335] [code=CPP] case 2: Cool.Square(); break; default: cout << "Huh?\n"; break; [/code][/QUOTE] I've never heard of that kind of triangle. Are you sure it's a valid form? | |
Re: [code=CPP] int main(int argc, char *argv[]){ char *dns = argv[1]; for(int i = 2; i < argc; i ++){ char *IP_URI_pair = argv[i]; // do something with the IP_URI_pair and the dns... } return 0; } [/code] | |
| |
Re: As AncientDragon said, CreateThread() can be used in windows. Check it out on MSDN. Following is some code to show you how to use it. Note that the thread proc should be of the form [icode]DWORD WINAPI myThreadProc(void*someData)[/icode]. someData is a pointer passed by CreateThread to your thread proc (I've … | |
Re: If you want 2 variables to refer to the same data, you can also use references: [code=CPP] int x = 5; int &y = x; cout << x << "," << y << endl; x = 10; cout << x << "," << y << endl; y = 15; cout … | |
Re: You might find STL maps useful for your "inverted structure". They're associative arrays, which makes searching for a particular element (e.g. the list of documents containing "bush") really quick and easy. They allow you to use e.g. a string ("bush", or "iraq") as the index... The element could also be … | |
Re: It's not necessary to define a member function as static. Often a static member is defined that holds the single instance to make accessing the class neater: myClass.h file [code=CPP] class myClass{ static myClass *inst; // singleton class instance int somePrivateVar; public: int someFn(); int someVar; myClass(); ~myClass(); myClass *getInstance(); … | |
Re: > int main(int argc, char **argv) { > > } I have a feeling that's not what he's after. He asked how to pipe data from ls > Anyone knows how to capture the data pipe in from linux ls command in c++ program? > > the command is ls … | |
Re: You can use stringstreams, itoa or sprintf to convert your int to a string of chars. [quote]The problem is that i get errors that i cant convert a int into char. even when i use a cast.. [/quote] The error would have been that you can't convert an int to … | |
![]() | Re: Just swap the pointers, as long as nothing else is referencing any elements in the arrays. If there are other references/pointers pointing into the array then do something else - like the temporary array thing (it'll be a bit trickier if the arrays are different sizes). |
The End.