Thanks Salem!
>> It might be safer in the long run to implement your own wrapper function.
Seems like FreeBSD's ifconfig implementation uses a similar approach to the one you suggested and they...
Type: Posts; User: fnoyan
Thanks Salem!
>> It might be safer in the long run to implement your own wrapper function.
Seems like FreeBSD's ifconfig implementation uses a similar approach to the one you suggested and they...
I am just trying to achieve the same goal by using different approaches, i.e. either by using strlcpy() or memcpy().
Thanks for the replies :)
Sorry, I did not include the full code snippet for the function....
In fact, as a matter course, I tend to nullify the buffer with memset() all the time (no matter I use memset or strlcpy())
...
Thanks!
I am also considering using memcpy() as a better alternative to type casting, but then I will have to do the no-sense below for almost every strlcpy() replacement
int len;
if...
Hi there,
I have a data structure as given below
struct ap {
uint16_t ap_freq; /* MHz */
int8_t ap_noise;
int8_t ap_rssi;
int8_t ap_snr;
uint8_t ...
Hi there,
I have a simple linked list composed of an int a pointer.
The code below compiles and runs fine, but I wonder whether I am wasting memory (or implementing the list in an...
Hi,
I would like to cipher data segmet of my executable say with a simple Caesar Cipher algorithm, i.e. any text should not be readable when executable opened with a hex editor.
It should be...
Hi
I have below classes
class moClassValueContainer {
public:
moClassValueContainer();
moClassValueContainer(string,int);
string name;
@Adak,
Actually, there is no "final format". Input file is CSV and process is "importing it" into DB. Below is first 4 lines of one example file. You can duplicate last two lines as much as you want...
Well, you are right....It is enough to have a memory location enough to hold the input str. Actually, I meant (if you refer the function definition of snprintf), the first argument is given as...
No fgets() is a better choice actually, obviously you can implement scanf() functionalty as a combination of fgets() + sscanf() functions.
Well, definitely the flushing does not work for you here. So, you may;
1 ) write your own function to read from input
2 ) Use scanf()
I'd vote for option 2
yes... so, you may want to write your own function.
Have you tried compiling the same code under Win32 (not with MinGW or Cygwin)? (i.e with a completely different fflush() implementation)
...
refer C FAQ
Question 12.26a
Question 12.26b
Change your network settings of Guest OS from NAT (which is default) to Host-only (most probably this will work for you).
With NAT, you do not have access to other OS's.
Host-Only Networking with...
Thanks for all the replies...
I used the zStrrmv() function from iMac and implemented the changes recommended by Salem. The import time is almost the same (about 50 mins).
I will follow...
@alter.ego
I highly recommend you to have a look at Pointers - C++ Documentation for clear understanding of pointers in C. It gives visual explanations as well which makes it easier to understand...
like
> for (j=0 ; j<strlen(line);j++)
This is awful.
Use line[j] != '\0' as the test
I am returning delim because I am testing the case in the code (if it is delim, I'will INSERT into SQL...
zStrtok() code needs much more improvement :) but regarding to Salem's question, it takes consecutive separators into account (returns separator itself in case of consecutive separators). The one...
to remove bad chars
(like ":;.%$#@[]{}|'<>*")
int zChrSearch(char *token,char s){
int i=0;
if (!token || s=='\0')
return 0;
while(token[i]) {
Hi,
I have huge CSV files that I need to import a database. For this approach, I have to write my own import function. The code works fine, except... it takes time to import files (sometimes an...
fgets - C++ Reference
Well, without having file2string code, all the commets will be nothing but a stab in the dark.
I would try running the code in a debugger and examine the code snippet where SIGSEGV occurs.
As twomers indicated, you can use +4 instead of dividing the str.size() by 4. Make sure that you examine the length of string before your loop to eliminate the cases where str.size()<4.
What is...
Well, I meant in printf().... I should have explicitly indicated actually...