- Strength to Increase Rep
- +5
- Strength to Decrease Rep
- -1
- Upvotes Received
- 9
- Posts with Upvotes
- 7
- Upvoting Members
- 7
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 2
- Interests
- different kind of stuff
- PC Specs
- dell vostro v131, celeron 867, archlinux openbox
Re: you need to modify only pointer "next", do you know what linked list is? If you know then you can draw something that you whant to do with it and then program this behaviour | |
Re: When you subtract two pointers, as long as they point into the same array, the result is the number of elements separating them and in this case each int is 4 byte for example.. then you get this otput on my pc: size of int 4 ptr before changes 2293496 … | |
Re: Try otputing to another file instead of windows console and read, as i see you use dos include. Please note that windows new line is not '\n' because it's one byte in linux LF and 2 byte in windows CR+LF please see http://en.wikipedia.org/wiki/Newline | |
Re: paste this into your file manager to test c:\\TurboC++\\Disk\\TurboC3\\sample.txt or use sameple.txt and put it in same dir as your exe | |
Re: are you shure you can use [fgets](http://www.cplusplus.com/reference/clibrary/cstdio/fgets/) ? why dont you use fread for start and try to copy image ? You can also use some hex editor to compare values. **fgets is for text...** | |
Re: if(dist<dr); remove semicolon ? should be or it will do nothing if dist < dr and do nothing on else if(dist<dr) { printf("checkcollision read true\n"); printf("dist: %f, radius+radius: %f\n",dist,dr); goback(0); goback(1); } | |
Re: It looks like it works, please explain better or post file. Also, yes you should take hex editor to know exactly wat you are dealing with.. If it is not 8bit chars then you need to parse it differently.. check out dragon post http://www.daniweb.com/software-development/c/threads/254246/how-to-read-unicode-utf-8-binary-file-line-by-line | |
Re: you reference wrong address, this causes core dump yes ? you add fprintf and maybe initialise some memmory then reference it by mistake, this could be answer m ? check address you reference, and addresses you allocate with memmory | |
Re: this for date ? :) and it should be very portable [Click Here](http://www.cplusplus.com/reference/clibrary/ctime/) | |
Re: you are not the first nor the last who needs to read from file, search google, good luck to you :) http://www.cplusplus.com/reference/clibrary/cstdio/fopen/ | |
Re: can you try this ? or strtol, please say if works while(fscanf(f,"%d",&value) == 1) { /* do something with the value */ } | |
Re: maybe you can use this http://www.cplusplus.com/reference/clibrary/cstdlib/strtol/ #include <stdlib.h> int main() { char *pEnd; printf("%ld\n",strtol("A",&pEnd,16)); return 0; } | |
Re: #include <stdio.h> #include <stdlib.h> #include <string.h> #define HOW_MANY_STRUCTS 20 #define MAX_NAME_LENGTH 30 typedef struct ritnish { int iRoll; char pcName[MAX_NAME_LENGTH]; }stRitnish; int main() { stRitnish s[HOW_MANY_STRUCTS] = {0}; srand(time(NULL)); memcpy(s[0].pcName, "TestName!",sizeof("TestName!")); s[0].iRoll = rand() % 1000; printf("Printing name [%s] and number %d\n", s[0].pcName, s[0].iRoll); return 0; } > ok waltp … | |
Re: post some example of log file, and what do you expect of it | |
Re: this i wrote for linux what is your platform ? my ubuntu - gcc #include <time.h> #include <stdio.h> int main() { time_t startSeconds; startSeconds = time(NULL); while(1) { system("clear");//platform specific check your platform this is linux/unix printf("%ld \n", time(NULL) - startSeconds); sleep(1);//platform specific check your platform and change this is … | |
Re: float is 8 bytes and int 4 bytes if you say %f you expect 8 bytes and type float #include <stdio.h> int main() { int iInt = 1; printf("int %d float %f",iInt, (float)iInt); return 0; } btw i suggest you read char buffer in and then convert it to float … | |
Re: use this http://www.daniweb.com/software-development/c/threads/429412/string-in-matrices | |
Re: this is what it means fifth is null terminator 065 in oct is '5' check ascii table #include <stdio.h> int main() { char str[]="S\065AB"; char strSame[5] = { 'S','\065', 'A', 'B', '\0'}; printf("str 1 %d \n", sizeof(str)); printf("str 2 %d\n", sizeof(strSame)); printf("same ? %d [%s] [%s]",strcmp(str, strSame),str, strSame); return 0; … | |
Re: [Arguments to main click](http://publications.gbdirect.co.uk/c_book/chapter10/arguments_to_main.html) | |
Re: or something like that #include <stdio.h> #include <stdlib.h> #include <string.h> char *safe_gets(char *buf, size_t size) { if (!fgets(buf, size, stdin)) return NULL; buf[strcspn(buf, "\n")] = '\0'; return buf; } int main(void) { char str[7] = {0}; int i, k = 0; int iLen = 0; printf("Enter string 1: "); fflush(stdout); … | |
| Re: take a look at this [Click Here](http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence) |
Re: int a[]={1,2,3,4,5,6,7,8,9,10}; You allocate memmory on stack here and a points to that memmory. Then pointer b points to that memmory location b=a i mean now b and a point to same location so you can work with it same as with a here you can try to print it's … | |
| Re: here is good link i found on google [Click Here](http://www.daniweb.com/software-development/c/threads/50370/starting-c-) |
Re: Actually all you need is to call function bigger 3 times in printbiggest. If input parameters x i z j bot you will need extra parameter inside function iMax first you get to know x and y biggest then save it and compare it to z then save it and … | |
Re: use printf("size of char %d size of int %d",sizeof(char),sizeof(int)); bot pointer is always 4 byte no ? maybe you can try to cast to char ? by the way where is problem? strcpy(*rowptr,"d"); strcpy(*(rowptr+1),"c++"); printf("ROWPTR+1[%s]",*(rowptr + 1)); strcpy(*(rowptr+2),"java"); printf("ROWPTR+2[%s]",*(rowptr + 2)); they print correct, no ? please see howto allocate … | |
Re: do you know how to create linked list ? if yes then to reverse you can use this post [Click Here](http://www.daniweb.com/software-development/c/threads/426342/singly-link-list-backward) you just take your list and while you traverse it just move to new in reversed order | |
Re: > Is it necessary to free the memory of the node that is deleted? What do you mean deleted then ? In c if you loose pointer to some data it is called memmory leak, cause no automatic garbage collection is implemented in c. In java if all references lost … | |
Re: use this [Click Here](http://stackoverflow.com/questions/1534912/how-to-build-in-release-mode-with-optimizations-in-gcc) ifeq ($(BUILD),debug) # "Debug" build - no optimization, and debugging symbols CFLAGS += -O0 -g else # "Release" build - optimization, and no debug symbols CFLAGS += -O2 -s -DNDEBUG endif all: foo debug: make "BUILD=debug" foo: foo.o # The rest of the makefile comes here... | |
Re: should it work same as strtok ? try not to use malloc and use array index instead of pointer arithmetic then when it works you can try pointer arithmetic(just increment address instead of index) and malloc Make working code and convert would be more easy maybe :) | |
Re: Maybe it is [stack](http://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29#Linked_list) ? you push new to first and then pop from first till last ? :) that will be reverse |