vptr
Members-
Content Count
6 -
Joined
-
Last visited
About vptr
-
Rank
Newbie
-
i have two working hard drives: one is 20G and another 80Gand one whitch doesn't work - 250G maxtor
-
Hello,I'm from Lithuania, city Telsiai. Not so far from Baltic sea ;]
-
hi,i havent checked the program because i dont program c++ but i think it works well. So...isn't it easier to do something like this:struct bit_array{ unsigned char bit8:1; unsigned char bit7:1; unsigned char bit6:1; unsigned char bit5:1; unsigned char bit4:1; unsigned char bit3:1; unsigned char bit2:1; unsigned char bit1:1;};struct bit_array array[2];and then you can easely manipulate bits like this:// first byte first bit is onarray[0].bit1=1;// second byte third bit is offarray[1].bit3=0;
-
The last movie i saw was 'Shrek 2'. Good movie, i like first part and i like second too.The donky is owesome
-
Hello, Read here about how to select timezone: http://support.modwest.com/content/5/258/en/how-do-i-change-timezone-for-php.html
-
Tastes Of Music what kind of music do you like?
vptr replied to palestranger's topic in General Discussion
me likes good hardcore, speedcore, noise and d&b. -
Hello, i have written an alternative function to strtok(), which i think is better and easier to use. I hope it will be usefull. Here is the code snippet from my program: 1 /* 2 * The Ultimate Network Tool. 3 * Copyright (C) 2004 Virtual Pointer 4 * 5 * The Ultimate Network Tool is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public 16 * License along with this program; if not, write to the Free 17 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 * 02111-1307 USA. 19 */ 20 21 #include <stdio.h> 22 #include <stdlib.h> 23 #include <string.h> 24 25 /* sample: 26 * 27 * char **tokens; 28 * ex_tokens("some string", ' ', &tokens); 29 * 30 * while (*tokens) 31 * { 32 * printf("%s\n", *tokens); 33 * tokens++; 34 * } 35 * 36 * free(*tokens); 37 */ 38 39 int ex_tokens(char *string, char c, char ***tokens) 40 { 41 int i, toks = 0; 42 char **tmp_tokens; 43 char *tmp_string; 44 45 46 if (string == NULL) 47 return (0); 48 49 for (i = 0; i < strlen(string); i++) 50 { 51 if (string[i] == c) 52 toks++; 53 } 54 55 if (toks) 56 { 57 toks++; 58 59 if ( (tmp_string = (char *)malloc(strlen(string)+1)) == NULL) 60 return (0); 61 62 memset(tmp_string, 0, strlen(string)+1); 63 64 if ( (tmp_tokens = (char **)calloc(toks, sizeof(char *)))) 65 { 66 toks = 0; 67 for (i = 0; i < strlen(string); i++) 68 { 69 /* cia toks patikrinimas tam jei stringas prasideda skirtuku */ 70 if (string[i] == c && strlen(tmp_string)) 71 { 72 if ( (tmp_tokens[toks] = (char *)malloc(strlen(tmp_string)+1))) 73 { 74 memset(tmp_tokens[toks], 0, strlen(tmp_string)); 75 strncpy(tmp_tokens[toks], tmp_string, strlen(tmp_string)); 76 memset(tmp_string, 0, strlen(tmp_string)+1); 77 toks++; 78 } 79 else 80 { 81 free(tmp_string); 82 free(tmp_tokens); 83 return (0); 84 } 85 } 86 else 87 { 88 if (string[i] == c) 89 continue; 90 strncat(tmp_string, (char*)&string[i], 1); 91 } 92 } 93 94 if (strlen(tmp_string)) 95 { 96 if ( (tmp_tokens[toks] = (char *)malloc(strlen(tmp_string)+1))) 97 { 98 memset(tmp_tokens[toks], 0, strlen(tmp_string)); 99 strncpy(tmp_tokens[toks], tmp_string, strlen(tmp_string)); 100 } 101 else 102 { 103 free(tmp_string); 104 free(tmp_tokens); 105 return (0); 106 } 107 } 108 109 free(tmp_string); 110 *tokens = tmp_tokens; 111 return (1); 112 } 113 else 114 return (0); 115 } 116 117 return(0); 118 }