168 Posted Topics
Re: cstring.h (C++; should be cstring) -> string.h (C) :) ssharish | |
Re: only static and global variables are set to 0 by default. ssharish. | |
Re: [code="c"] #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <time.h> typedef struct { int *array; } MODEL; int main() { MODEL *node; int index; srand( time(0) ); if( ( node = malloc( sizeof( MODEL ) ) ) == NULL ) { perror("malloc"); return 1; } else { printd("1. Node creation successful\n"); … | |
Re: ohhh man, it is so difficult to go through your code man. It need to really concentrate on how to indent your code. Give some spacing between instruction and it so compack. And your comments, just makes the code really hard to read. Do some work on it, i will … | |
Re: It would have been more nice, to see what problem you had. May be we could learn more from that as well. Please do post the problem and the solution you came your problem. You might get some more help and perhaps some feedback on your solution. NOTE: If you … | |
Re: champnim, I suspect the problem might be when you free the node which wanted to delete. Perhaps, the memory leak. Do you know the abc char ptr which you have in your node, that needds to be freed as well, before you free temp!!! ssharish | |
Re: [code] a(domain); [/code] should be [code] a(Domain); [/code] And main should return 0 on successful return. Perhaps it internally does so. But its good practice to specify them explicitly. ssharish | |
Re: well, this question donst even make any sense, how will we know what IP and the port address you URL uses. when you enter your URL that get resolved y your DNS. If you are looking for the IP address ofthta url, try pinging to that url you will get … | |
| |
Re: For me the code works fine, with some minor changes in it. But the code it self is working ok except the integer size. Since you are using turbo C compile which is a 16 bit compiler, the integer size is smaller than ity should be, and that the reason … | |
Re: The easy was undersatnding the function is, by think of something like this well. If you have huge lot of code in main, then its a vewry bad programming practice. It is very important that we think before we code it. As said before, if you a huge main function, … | |
Re: As it’s been previously mentioned that, there are quite a few problems in your code. Which you might have to sit down and think about. I will point you out few error which you have made. 1.The memory allocation for char point word is not right. [code] Char (*word)[30]; Has … | |
Re: hahaha here we go a homewok thread again. SivaKrishana show us a snap or some of your code, that way you might get some more help. Luckychap had shown some code, which is some thing very important for your application. Have a look at it. ssharish | |
Re: Have a look at this tutorial[URL="http://msdn2.microsoft.com/en-us/library/ms810467.aspx"] Serial Programming [/URL]and [URL="http://ontrak.net/mfc.htm"]this[/URL] as well. ssharish | |
Re: [QUOTE=savio_1987;508540]sorry for being so vague, but i am just starting with this and this is my first project, well i am using turbo C version 3 and i am developing for windows XP thanks[/QUOTE] Well, Turbo C compiler o more supported. Try think of changing to a new compiler. Like … | |
Re: According to your subject title what i can understand is that u are trying to read data from serial and redirect it top PS/2. Well, PS/2 are basically used for input devices, and perhaps if u wanted to read anything from there, u just access it through stdin standard input … | |
Re: Compiler flag are not there to use randomly, they should used according to the requirment. Use the main page to get the complete list of compiler flags wiht the brief expplaination of it. Some of the common one used is -Wall -W -ansi -O<x> -o -g -c -I. ssharish | |
Re: Well, C supports in multi threading. But before i can say anything about light weight process. I should ask you which OS and compiler are you using. If you are on Linux, you should looking at something called pthread library. ssharish | |
Re: on what i know so far, u cant update the contents directly on to the file (well perhaps u can). Perhaps what i would suggest is read each line from the source file into a string. i.e line by line. See if u need to make some changes in that … | |
Re: OK, what you wanted to really do is to accept a infix express and then convert them into reverse polish express and then evaluate the express. This is achieves using stack and Q's concept in data structures. Have you done data structure before. Get a data structure book and see … | |
Re: YES, it does say to prototype there [QUOTE]get_current_dir_name(), which is only prototyped if _GNU_SOURCE is defined[/QUOTE] [url]http://linux.die.net/man/3/get_current_dir_name[/url] ssharish | |
Re: What is your hardware, where is it connected, how much memory does it have? ssharish | |
Re: What you are after is something smilier to this. [code] char Buffer[20]; int count = 10; sprintf(Buffer, "my_id_%d_", count); [/code] To be more safer on hand use snprintf, if you are worried about overflow and all. Do the same for your send concatenation. The above is just an sample code … | |
Re: Cant you use ifndef-else-endif directives? EDIT: Run time, i wonder you could. ssharish | |
Re: Something like this [code] #include <stdio.h> #include <stdlib.h> int main() { FILE **fp; char filename[20]; int i; fp = malloc( sizeof(FILE *) * 10); if( fp != NULL ) { for(i=0; i<10; i++) { sprintf(filename, "%s%d.txt", "file",i+1); if( ( fp[i] = fopen(filename, "a+") ) == NULL ) { printf("Error: File … | |
Re: The normal approach for this problem is to read 4 lines and then read 5th line and again read 4 lines and then read the 5th line and so on. You could even use fseek but the problem with that is you should be having the right offset value. In … | |
Re: perhaps look at this one as well. [code] #include <stdio.h> int main() { int a[10]; int *a1; printf("%d\n", sizeof(a)); printf("%d\n", sizeof(a1)); getchar(); return 0; } /* my output 40 4 */ [/code] Ancient Dragon, sizeof(int *) and sizeof(int) just gives 4 bytes. That makes size since all memory location are … | |
Re: So the solution for that porblem is to stop using scanf function and perhaps WaltP has give you a good link on what are the function which need to avoided and it also explains about the scanf in more details so start thinking about an alter native way of reading … | |
Re: [QUOTE=Bamirasta;493678]But, Lets say what you have stored in your buffer is the contents of your file that you've open,. How do you get all the content of that file into your string without it stopping after the first null.???[/QUOTE] Sorry dint really get u when u said "without it stopping … | |
Re: Here is a sample code which u could use or perhaps u can get an idea on how to use sscanf function to parse the string. [code] #include <stdio.h> int main() { char str[] = "# Name: C02427.mol TAUTOMER 1 2706"; char str1[20], str2[20], str3[20]; int D, D1; char FileName[35]; … | |
Re: George, nobody is going to do u'r homework. Please read the form rules before asking question. It would be more better if u could show us what have u got so far. Do u know how the Depth First Search algorithm works. It very important u understand the algorithm before … | |
Re: Thats one lot of mess, you should start indenting your code properly and perhaps what happened to your code tags. You will have to put your question properly in order to get more help. From what u have said i have come up with the sample code which will give … | |
Re: That piece of code just keeps in reating the same thing again and again for ever. I mean it just displays the same thing. U will have to update something as the game goes along. So you will have to get some input from a particular source. And have u … | |
Re: [QUOTE=WaltP;492559]Do you really want your operating system to do the logging? Or do you only need a file created with log entries in it?[/QUOTE] WaltP I am pretty curious to know now, how would you make OS to log things for. As far i know it should have done by … | |
Re: i cant unzip it on my machine, just use the windows compress utility feature. Or perhaps just post the make file contents ssharish | |
Hello, I have this problem from past few week now, which i haven't rectified. Hope I get some suggestion from here. I bought a new SATA2 Hdd 2 weeks before and there is no problem with that hard disk what so ever. The problem is with all my old hard … | |
Re: what actually are u trying to do with strfmon. You could so few things using sprintf family as well. As said before strfmon is not a standard function, no protability at all. ssharish | |
Re: [QUOTE]im trying to sort my random numbers to odd numbers and even numbers,,[/QUOTE] What u wanted to sort on both odd and even in the same array. Stars all over head lol You can sort either on odd or even thats it. Perhaps u can have two array one sorted … | |
Re: [code] conf_fd=open("/etc/example/server.conf",O_RDONLY); read(conf_fd,conf,100); close(conf_fd); [/code] This reads the whole content of the file server.conf [code] /* Get server IP */ buffer=strtok(conf,";"); buffer1=strtok(NULL,";"); [/code] This breaks the string into two lines. [code] strtok(buffer,"="); server=strtok(NULL,"="); server_ip=inet_addr(server); [/code] This gets IP address from the second line. To be more precise, in the second … | |
Re: Probably this would give u what u want. Try use that function and see what u get on each return value. LPCTSTR lpRootPathName, ssharish | |
Re: [URL]http://en.wikipedia.org/wiki/Fixed-point_math[/URL] ssharish | |
Re: I would really suggest to use the temp variable to swap two values. Cos the swapping variables without third variable such as using the arithmetic operators. This would really very help only when you wanted to swap unsigned integers. Apart from that it is not a recommended at all. If … | |
Re: What happenes, the function throwstring() return the pointer to the first elements of the string const - which is located in heap- to the main. And printf use the base address to print of the full string till it hits NULL. And as mentioned before. You should specify the int … | |
Re: [quote] I'm getting a the error "passing arg1 of 'strcpy' makes pointer from integer without a cast.... [/quote] This is where you get the error right [code] strcpy(make,newnode->make); strcpy(model,newnode->model); [/code] strcpy will get two char pointer (char *) as an argument. But you are passing just a (char). Which in … | |
Just wondering, if anyone has got a library or good link to parse a config file. If not is there any effcient way of hanlding config file, where the config is just normal text file. Its not XML file or anything. ssharish | |
Re: So which part fo the code u dont understand well? Where did u get the code from? ssharish ![]() | |
Re: Why do you want to use text editor, when you have a good IDE's. Try Dev-C++. ssharish2005 | |
[code] #include <stdio.h> void printarray(const int arr[][3]); int main() { int arr[][3] = {{1,2,3},{4,5,6}}; printarray(arr); getchar(); return 0; } void printarray(const int arr[][3]) { int i,j; for(i=0;i<2;i++) { for(j=0;j<3;j++) printf("%d\t", arr[i][j]); printf("\n"); } } [/code] This above code tends to give me a warning. [code] 9 D:\cprogramming\arr1.c [Warning] passing argument … | |
Re: Before doing anything about it. You should be having a good understanding of how to use stack and learn more about POSTFIXand INFIX. And google about POSTFix and INFIX algorithm. You will some ton's links ssharish2005 ![]() | |
Re: use sleep() function which is defined in time.h. It has only a resolution of 1 millisecond however. So if you say 5000 it would be 5sec i suppose. ssharish2005 |
The End.