Search:

Type: Posts; User: fnoyan

Page 1 of 12 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    10
    Views
    14,191

    Thanks Salem! >> It might be safer in the long...

    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...
  2. Replies
    10
    Views
    14,191

    I am just trying to achieve the same goal by...

    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 :)
  3. Replies
    10
    Views
    14,191

    Sorry, I did not include the full code snippet...

    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())
    ...
  4. Replies
    10
    Views
    14,191

    Thanks! I am also considering using memcpy()...

    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...
  5. Replies
    10
    Views
    14,191

    vasting uint8_t to char *

    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 ...
  6. Thread: Linked lists

    by fnoyan
    Replies
    1
    Views
    667

    Linked lists

    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...
  7. Replies
    1
    Views
    2,234

    Ciphering data segment of program

    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...
  8. Replies
    1
    Views
    1,552

    Cannot push_back string at the end of vector

    Hi

    I have below classes


    class moClassValueContainer {
    public:
    moClassValueContainer();
    moClassValueContainer(string,int);
    string name;
  9. Replies
    22
    Views
    3,883

    @Adak, Actually, there is no "final format"....

    @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...
  10. Well, you are right....It is enough to have a...

    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...
  11. Replies
    34
    Views
    5,927

    No fgets() is a better choice actually, obviously...

    No fgets() is a better choice actually, obviously you can implement scanf() functionalty as a combination of fgets() + sscanf() functions.
  12. Replies
    34
    Views
    5,927

    Well, definitely the flushing does not work for...

    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
  13. Replies
    34
    Views
    5,927

    yes... so, you may want to write your own...

    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)
    ...
  14. Replies
    34
    Views
    5,927

    refer C FAQ Question 12.26a...

    refer C FAQ

    Question 12.26a

    Question 12.26b
  15. Replies
    2
    Views
    982

    Change your network settings of Guest OS from NAT...

    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...
  16. Replies
    22
    Views
    3,883

    Thanks for all the replies... I used the...

    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...
  17. @alter.ego I highly recommend you to have a...

    @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...
  18. Replies
    22
    Views
    3,883

    like > for (j=0 ; j

    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...
  19. Replies
    22
    Views
    3,883

    zStrtok() code needs much more improvement :) but...

    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...
  20. Replies
    22
    Views
    3,883

    to remove bad chars (like ":;.%$#@[]{}|'*")...

    to remove bad chars

    (like ":;.%$#@[]{}|'<>*")
    int zChrSearch(char *token,char s){
    int i=0;

    if (!token || s=='\0')
    return 0;

    while(token[i]) {
  21. Replies
    22
    Views
    3,883

    fastest way of processing a file

    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...
  22. Replies
    6
    Views
    14,546

    fgets - C++ Reference...

    fgets - C++ Reference
  23. Replies
    13
    Views
    1,887

    Well, without having file2string code, all the...

    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.
  24. Replies
    13
    Views
    1,887

    As twomers indicated, you can use +4 instead of...

    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...
  25. Replies
    12
    Views
    2,971

    Well, I meant in printf().... I should have...

    Well, I meant in printf().... I should have explicitly indicated actually...
Results 1 to 25 of 280
Page 1 of 12 1 2 3 4