15,300 Posted Topics
Re: [QUOTE=gazaa;232665]Americans tend to pronounce is as "r - out - er", the same way as they pronounce route "r - out" Brits and a few other nationalities tend to pronounce is as "rooter" as we pronounce "route" as root. Simple, eh?[/QUOTE] Brits speak funny anyway. Especially humerous is the way … | |
Re: 1. don't use the version of fstream and iostream that have .h extension -- they are depreciated (obsolete) and were replaced by versions without extension. But if you are using an ancient compiler such as the original Turbo C++ you may have no other choice. 2. Don't use global variables … | |
Re: >>I'm getting this error from this code what line number contains the error ? >> do you guys also work in multiple files? Yes, my projects at work consist of several hundred files where the implementation code and header file of each c++ class are contained in their own files. … | |
Re: >>what the int main(); thing is about all functions have a return type such as int, char*, double, etc. main() is a special kind of function and is the only function required by the C and C++ standards, and it is required to return an integer back to the operating … | |
Re: [QUOTE=winbatch;344956][URL="http://www.daniweb.com/techtalkforums/member134320.html"]vijayan121[/URL], I don't think ifstream works for files over 2GB, which mine is. (7GB)[/QUOTE] If this is on an MS-Windows machine, them you may have to use win32 api file i/o directly on that large a file. See CreateFile() to open the file, and ReadFile() to read its contents. All … | |
Re: >> strncpy(who[i],huj,300); This line is probably causing the problem. each element of who can only contain 100 characters and that line is copying up to 300 characters into it. Won't fit. | |
Re: >>Extract the lower 4 digits of the result produced by step 2. The easy way is to convert the number to a string then only use the last 4 digits. [code] int num = 12347; char buf[10]; sprintf(buf,"%d",num); int seed = atoi( &buf[1] ); [/code] | |
Re: my guess is that you forgot to include one or more header files. You should post the line(s) the compiler is complaining about. | |
Re: probably are no such tutorials, but you can search [URL="http://www.symbian.com/symbianos/index.html"]their web site[/URL]. | |
Re: See the [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/commondialogboxreference/commondialogboxstructures/openfilename.asp"]OPENFILENAME[/URL] structure and GetOpenFileName() function They already have the options you want. And [URL="http://www.codeproject.com/listctrl/drivepickerlist.asp"]here[/URL] is a drive picker MFC class. Download the source code for this project and it will show you how to get the list of drive letters that are available on the computer. | |
Re: just put the char array variable name inside atof() [code=c] char num[] = "99.0"; float n = atof(num); [/code] | |
Re: I think he wants to duel boot xp and vista. I didn't have any problems doing that but I had xp on drive C and installed vista on drive D (two physically different hard drives). | |
Re: MSDN will normally tell you what header files and libraries are need for a given function. goto [url]www.microsoft.com[/url] and search for the function name. | |
Re: 600 non-M$ products seems pretty good for an os that has only been officially released for a couple months. | |
Re: >>Also I dont know how to switch the percantage How would you do this with pencil and paper. If you buy a pencil for $1.00 and the taxes are 6 percent what it the total price? Hint: 1.00 plue 1.00 * 0.06. The same in your problem. If you enter … | |
Re: [URL="http://www.daniweb.com/code/coder46588.html"]Here[/URL] are two more examples. There are others in Code Snipets board too. | |
Re: post the code for what you know how to code and ask questions. We'll be glad to help, but we don't write it for you. | |
Re: something is probably corrupting the memory pool some place else in your program and that's a difficult problem to find. If you have a large progrm I would start by commenting out large blocks of code until the problem goes away. That at least narrows down the search. | |
Re: >>I need help finding a gui library for c/c++ It's called the win32 api functions and is supplied with all Microsoft compilers as well as most other compilers that target the MS-Windows operating system. There are about 100 or so libraries included in it. Here is a[URL="http://www.winprog.org/tutorial/"] popular tutorial[/URL] to … | |
Re: you declare a 2d array of strings like this [code] const int ROWS = 255; const int CHARS_PER_ROW 20 char array[ROWS][CHARS_PER_ROW]; [/code] then it looks like this [code] char get(char array[ROWS][CHARS_PER_ROW]) { ifstream fin("input.txt"); if( fin.is_open()) { int row = 0; while( row < ROWS && fin >> array[row++] ) … | |
Re: depends on the operating system. MS-Windows uses boot.ini in the root directory. | |
Re: if that first loop is trying to count the number of words in the file, it won't work because words can be separated by one [b]or more[/b] spaces or tabs. You don't need to count the number of words anyway. just change the second loop to read until fscanf() returns … | |
Re: If you don't want it to exit then what do you want it to do ? you can create a loop as below, but the problem with this is that there is no way to quit the program when you want it to. [code=c] int main(void) { while(1) { printf("hello, … | |
Re: [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getclientrect.asp"]GetClientRect()[/URL] returns a RECT object with the coordinated, then simple subtraction will give you height and width. | |
Re: not buffer overflow -- you are not checking that strpbrk() returns a NULL pointer, which it can if the string does not contains the characters. pch is a 2d array of pointers, so if strpbrk() returns NULL that printf will fail. The format specification in printf() is incorrect too -- … | |
Re: You failed to say what the problem is, but if you want to read one column at a time then using the extraction operator like that won't work right with csv files because columna may, or may not, be separated by white space (spaces and/or tabs). The csv files I've … | |
Re: what are the error(s) your compiler gives you ? A quick once-over looks like braces are missing from lines 26 and 38, and remove the semicolon on line 38. | |
Re: check the client to see if it is sending the '\n' character. maybe it just terminates and doesn't send it. Also, your server program should check for buffer overflow before adding a new character. Terminate the loop if the buffer fills up. | |
sometimes I get this error, if I try it again it works as expected. | |
Re: Microsoft MFC has a c++ socket classes, but I hear it isn't very well liked. You might check boost libraries, it probably has something. | |
Re: [QUOTE=viraltaj;341532]Yes the url was removed by the moderators.. I dont know why but may be the policies of dani restricts this. Anyways.. I came to this forum to learn C++ in depth. Yes I know a lot in it but I think its stil not enough. The Taj operating system … | |
Re: Read about the printf format string -- you can specify the field width for strings and whether they are left or right aligned. [code=c] int main() { printf("%20s\n", "Hello"); printf("%20s\n", "Hello World"); return 0; } [/code] That will print the word "Hello" in a field that is 20 characters wide … | |
Re: [QUOTE=mcklein_tunde;341874]please how can i use bottons in C?[/QUOTE] what operating system ? what compiler ? what GUI library ? There are hundreds of ways to do it depending on the answers to those questions. But in no case can you do it in text-mode window like the MS-DOS command prompt … | |
Re: Aia is absolutely and positively correct. If we write the program for you then (1) we will not get the grade, you will and (2) you will learn nothing. | |
Re: how was it initialized and allocated (new or malloc() ? Is list or str NULL pointers ? Hard to say what the problem is without more code. | |
Re: start by reading the [b]Read Me[/b] threads at the top of this board. | |
Re: >>could you help me Yes, but you will have to post your code first because I can't see your monitor. | |
Re: OMG vijay where did you learn programming :eek: The code you posted still contains buffer overflow. >>most compilers will allocate more memory than seems is necessary for data compiler-specific behavior and something you must never ever count on. talk about taking advantage of undefined behavior :eek: | |
Re: you have to use one of the convertion functions. Example:. [code] char val[] = "123"; int n = atoi(val); [/code] ![]() | |
Re: The new line in the text file is operating-system dependent. *nix uses '\n', MAC uses '\r', and MS-DOS/MS-Windows uses two characters "\r\n". Which is why text files that are transferred between operating systems are often run through a translator to convert from one format to another. | |
Re: [QUOTE=Lardmeister;340429]You cannot use C to solve this problem. The highest integer value it can use is: unsigned long (32 bits) goes from 0 to 4,294,967,295 max. There are other languages that can handle very large integers easily.[/QUOTE] I think most compilers support 64-bit integers nowdays (long long or __int64) [edit] … | |
Re: [QUOTE=Aia;340621]If you would have to write your own implementation of the function [COLOR=Blue]getchar()[/COLOR] in C; how would you do it?.[/QUOTE] It would have to be compiler and os specific which is why the C standards did not dictate how the function is to be implemented. You could use non-standard functions … | |
Re: Vista and XP have different versions of DirectX so maybe that's the problem. You could try comiling on XP and see if it will run in Vista. There are a lot of programs that run in XP but not in Vista, and probably vice versa. | |
Re: All the above. If you are new to c++ then you are not ready to tackle that project -- companies have spent years of manhours on that sort of project and those programmers are highly experienced people. database programs do not bring the entire files into memory because the files … | |
![]() | Re: I just use regsvr32.exe program in a command prompt window to register a DLL -- no difference between versions of MS-Windows. ![]() |
Re: TCHAR is a macro that is defined to be char* if UNICODE is not defined, or wchar_t if UNICODE is defined. If you want to convert from char* to wchar_t* regardless of UNICODE definition then you can not use the TCHAR macro. one data type can not be converted to … |
The End.