5,237 Posted Topics
Re: Does this even compile? > return status; I see no status declared anywhere. > CA2CT mailHostConverted(mailHost.c_str()); This looks like it's stuck half way between a function prototype and a function call. > conn.Connect(mailHostConverted); I imagine this returns a status, why not test that to see whether the connect failed or … | |
Re: > So better keep in mind that if the file is not present a new one with the same name will be created. Not if you're opening it for reading it won't. | |
Re: Well you can create a short string with [code] char s[2]; s[0] = ch; s[1] = '\0'; [/code] Then pass that to atoi, though strtol etc are better long term bets. A quick answer is to do [code]intVal = ch - '0';[/code] | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] The first step would be to create a program which allows you to input a team / player, and print the information back to the user. Until that works, there is no point trying anything else. | |
Re: Please format your code [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] Colourful, but variable spaced and unindented - bad. Monochrome, fixed width and indented - good. | |
Re: [code] NAME ftw, nftw - file tree walk SYNOPSIS #include <ftw.h> int ftw(const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag), int nopenfd); [/code] | |
Re: > The reason for this error might be that I am not allocating any memory for the pointer(correct me if I am wrong). Yes, it has been allocated, but the memory which you're pointing at is read-only (meaning you can't change it). The variable p can be changed (say p="world"), … | |
Re: If this is your first foray into graphics, you might want to get the libsdl devpack installed as well. [url]http://www.libsdl.org/index.php[/url] The 's' is for "Simple" | |
Re: > while(charbuff[i]!=' ') Maybe this is false on the first iteration, therefore i never gets modified and the function exits without doing anything. > ........... some code Post COMPLETE whole programs which show the problem. Most efforts to snip out "irrelevant" code usually end up snipping out something really vital … | |
Re: > fscanf( fINPUT, "%s", &IP_name[j]); > printf("%s\n", &IP_name[j]); You're still using & where you shouldn't (on both of them). Gah - beaten | |
Re: > char s[2]; How many buffer overflows have you written today? | |
Re: > can anyone explain me why the values are not swapped in the below code ?? Another problem is that your pointers are uninitialised - who knows, maybe they both point at the same memory location. | |
Re: > # define EOF =-1 You should really have [inlinecode]#include <stdio.h>[/inlinecode] | |
Re: [url]http://www.cs.helsinki.fi/group/goa/mallinnus/lines/bresenh.html[/url] Build up your own little graphics library of functions which you can call from the rest of your application. Once you've mastered something like putPixel(), the rest should be pretty easy. | |
Re: > ya thaxs it works Rather too easy to break IMO [code] #include <stdio.h> int swap ( int *a, int *b ) { *a ^= *b; *b ^= *a; *a ^= *b; } int main(void) { int a = 2, b = 3; printf( "%d %d\n", a, b ); swap( … | |
Re: Have a long hard read - [url]http://www.nondot.org/sabre/os/articles[/url] | |
Re: I agree with Ancient Dragon, the code is broken. You basically have variations of the problems listed here [url]http://c-faq.com/expr/index.html[/url] | |
Re: Yes, you find the manual / help pages which describe the string class. This will detail the public interface to the class. Say perhaps [code]string foo; foo.length();[/code] | |
Re: > and i wonder if anyone can tell me what´s wrong with this code Posting error messages helps. > end1; In your case, I guess you mean endl That's lower-case "L" (l) at the end, not numeric one(1). | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: [url]http://www.cplusplus.com/ref/iostream/istream/getline.html[/url] getline allows you to specify a delimiter of your choice, if it's a single char. | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] Then do things like - count opening and closing braces - look for missing ; (or indeed as in your case, mis-placed ; ) | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: > car *ptr = &catalogue[0]; What does this achieve? You can do this [inlinecode]cin.getline(catalogue[i].make,20);[/inlinecode] > delete [] catalogue; You need to do this after you've finished printing the data, not before. > however on the first run through the loop, the "make" of the car is not stored in the … | |
Re: > [inlinecode]array[i+1] *= array[i] ; [/inlinecode] Since this is just short for [inlinecode]array[i+1] = array[i+1] * array[i] ; [/inlinecode] All the calculations involve undefined values because i+1 element is read before being written (in the absense of any other initialisation). | |
Re: > It waits only process number 1, and not number 2. Why? Because you asked it to. If you use -1 as the pid, then it will wait for any child, and return with the pid of the child which ended. Put that into a loop until all your children … | |
Re: Start by stating what the problem is you're trying to solve rather than imagining using strstream is the answer. Tell us the problem you're trying to solve, not how to fix your solution. Have you considered for example a vector of unsigned chars for storing your binary data? > but … | |
Re: Like [code] #include <iostream> #include <string> using namespace std; struct record { string C[3]; }; int main() { record param; param.C[0] = "heading1"; param.C[1] = "heading2"; param.C[2] = "heading3"; int key = 0; string data = param.C[key]; cout << "DATA: " << data << endl; return 0; // zero is … | |
Re: > but there's specific reasons why I was wanting to compile and run under Miracle C. Because you're a masochist? Like Dave said, Miracle C is a silly PoS compiler which looks great if your homework was "write a C compiler", but is utterly useless for anything more complicated than … | |
Re: > char temp[81]=""; But apparently your words are up to 1000 characters long. Fix this, or fix your arrays. > y[1000][1000] 1MB of unused space, just get rid of it. It seems to me that you're likely to be blowing away your entire stack (and much more) before you've even … | |
Re: What about your source code, does it include windows.h before including any other windows header file? | |
Re: > but the memory that was used is not freed up If you worked this out by watching task monitor or process explorer, then it wouldn't. The program memory manager usually holds onto the memory for future memory requests from your program (which is relatively quick), rather than asking the … | |
Re: > call to function 'Printf' with no prototype in function main" Or maybe check the spelling. C is case sensitive, so Printf is not the same as printf | |
Re: Well either you do it all yourself by reading [url]http://beej.us/guide/bgnet/[/url] - to learn basic network programming [url]http://www.rfc-editor.org/[/url] - to learn about the protocols which interest you Or get a library to do a bunch of stuff for you, eg. [url]http://curl.haxx.se/[/url] | |
Re: > Elapse Time Since Program Start Working What do you mean? The amount of time, as measured by the clock on the wall? The amount of time the program has used? If your program is low priority, say it's only using 10% of the CPU, there is a big difference … | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] And [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] | |
Re: [code] int* fn0() {int solution[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … | |
Re: [url]http://www.faqs.org/docs/securing/chap29sec254.html[/url] Are you entirely sure that apache is seeing the same directory structure that you're seeing? Which real / effective user ID's is apache running with, and do these have appropriate permissions to access the files? Create a simple C++ program which allows you to log all this information, and … | |
Re: Please annotate your code listing with some comment indicating [code]// This line causes this error // vector<int>::vector(const int, const int, const int)' [/code] | |
| |
Re: > 1) If we have a filed in the struct which his value is known to us Seems good to me - no extra storage needed, like working out how to allocate a big enough array of pointers. Also, checking time increases with the length of the list. Call the … | |
Re: What does SetMaxColRow() actually do? If you just construct and destruct this object in a test program, does it still crash? Have you looked at what other things are doing elsewhere? Just because it crashes here doesn't mean the problem is here, when dealing with dynamic memory. | |
Re: Ever heard of google? [url]http://www.google.co.uk/search?q=malloc[/url] Ever bothered to read threads on the same page with malloc in the title? [url]http://www.daniweb.com/techtalkforums/thread46636.html[/url] | |
Re: new is C++ malloc and calloc are C calloc is the same as malloc, except for it clears memory to all bits zero. new causes constructors to be called, malloc does not. | |
Re: C'mon, you could have at least posted your most recent attempt at the code [url]http://forums.devshed.com/c-programming-42/sorting-356010.html[/url] This post here is nearly an hour newer than your reply to my original comments, yet it's the old code. | |
Re: > void main (void) main returns an int > int a,ab[5,2],ad[5],b; A 2D array would be [inlinecode]int ab[5][2];[/inlinecode] Likewise, accessing it would be [inlinecode]scanf("%d",&ab[a][0]);[/inlinecode] | |
Re: Which compiler (and which version)? Which version of windows? [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfile.asp[/url] Scroll down to "Communications Resources" | |
Re: [url]http://c-faq.com/struct/padding.html[/url] How you specify a packed structure depends on your compiler. | |
Re: > double variable[1000][1000] = { 0 }; In other words, about 8MB in size. You're basically blowing away the stack, which depending on your machine could be as little as say 16K in size. Depending on your compiler, you can specify the initial stack size as being something else. Since … | |
Re: Well you could state your OS and compiler. There is no standard way to achieve sub-second delays. |
The End.