Search:

Type: Posts; User: deathmetal

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thank you. I don't know why this wasn't splitting...

    Thank you. I don't know why this wasn't splitting string on my end.
    It works with below string as well with no comma or ;



    char tab[] = "house";


    perfect. :)
  2. c code: split string || multiple/optional delimiters || memcpy - optimize

    Hi devs,

    I am writing a code to parse strings with genetic information. Data are clunky with randomness.
    For example,


    I need name of each gene separately: GENE1, GENE2 and such. It is...
  3. This is first time I am using getline. If I...

    This is first time I am using getline.

    If I code as the following I have to define line char array of a defined length. The column count is fixed in the input file, however, the characters in...
  4. Thank you. actually I didn't have a new line...

    Thank you.

    actually I didn't have a new line character in printing that is why poor ptinting.



    void remove_trailingspaces(char *newlines)
    {
    size_t length = strlen(newlines);
    ...
  5. Thank you for your reply. I do not have any...

    Thank you for your reply.
    I do not have any reason to parse first line (header). The posted data may not have tabs, but the file has. Attached is a small file with first few columns.

    My goals are...
  6. strtok: line split || cannot unhinge previous split

    Hi there,

    Please bear with me. I have a file with multiple columns. I would like split and perform some operations.
    When I read file and split using strtok on tab separate it works fine, but I...
  7. No problems. I will try with #5. If you get...

    No problems.

    I will try with #5.
    If you get chance can you please review my code I put in my last post?

    Thank you laser!
  8. Any code you tried that you could share? What...

    Any code you tried that you could share?

    What are these series/numbers based on in each row?
  9. hi laserlight, the code (trim_whitespace(char...

    hi laserlight,
    the code (trim_whitespace(char *text) with *text = '\0'; in the end ) you shared doesn't work on my end.

    Doesn't work mean I don't get the gene name, but complete line.
    It could...
  10. Thank you. I guessed it could be an issue...

    Thank you.

    I guessed it could be an issue with local and global variable.
    Now, I provide another array, copy into it and it works.





    #include <stdio.h>
  11. modify char array in function || reading lines from file

    I read in file with four columns skipping line one. File is tab/space delimited, my goal is to get the last column.

    I use function where parameter is char array. The function is OK as long it is...
  12. Replies
    16
    Views
    13,537

    Thank you. I got it.

    Thank you. I got it.
  13. Replies
    16
    Views
    13,537

    I would like to store the returned in the result...

    I would like to store the returned in the result array, so I make changes as below after //
    It gets annoyed with an error:





    if I make above change I get error as
  14. Replies
    16
    Views
    13,537

    Thank you laser~!

    Thank you laser~!
  15. Replies
    16
    Views
    13,537

    I have never used strncat. I think the third...

    I have never used strncat. I think the third parameter is for the number of characters to append. That makes me ask
    in dest_maxlen - left_len - 1

    is -1 at the end for the null character?
    ...
  16. Replies
    16
    Views
    13,537

    Thank you laserlight. I have folowing...

    Thank you laserlight.

    I have folowing questions:
    1) I cannot understand why dest[0] = '\0'; is needed in the first place.

    2) is it OK to mix size_t with C code? As far as I remember C doesn't...
  17. Replies
    16
    Views
    13,537

    concatenate string || better way

    Hi there,

    I am new to C from biology background.
    I have two char arrays I would like to concatenate. The expected output is two different strings. For example inputs are john and abbey.

    The...
  18. Replies
    4
    Views
    503

    Hi Matt, Thanks for your reply. unsigned...

    Hi Matt,
    Thanks for your reply.


    unsigned int j=0; ...
  19. Replies
    4
    Views
    503

    C: removing extra spaces in line

    Hi,
    My goal is to remove extra spaces from line.

    I've tried multiple ways, many variables. But I get error for seg fault.

    My code:



    unsigned int j=0;
  20. Replies
    3
    Views
    827

    Hi laser, Thanks much for your reply, and...

    Hi laser,
    Thanks much for your reply, and explaining in detail.
    I'm still trying to absorb what you've said.

    I've fixed my code or malloc.

    Thank you again.
  21. Replies
    3
    Views
    827

    I can have 2D array as: 1) char *p[10]; ...

    I can have 2D array as:

    1)


    char *p[10];

    Or,

    2)
  22. Replies
    3
    Views
    827

    C: array of string - understanding

    gcc -v
    gcc version 4.9.2 (GCC)

    Compiling code:


    gcc -g -Wall -Wextra *.c -o program_parse -pedantic -std=gnu99


    I've a function which takes in a character array, parses it by tab. And...
  23. Replies
    12
    Views
    7,527

    Hi, Thank you for pointing out to the error....

    Hi,
    Thank you for pointing out to the error. Finally it got fixed. Compiler was annoyed with:


    p=strtok(line,'\t');


    in stead of:
  24. Replies
    12
    Views
    7,527

    if I include string.h anywhere else and compile,...

    if I include string.h anywhere else and compile, I get warnings as:
  25. Replies
    12
    Views
    7,527

    Hi laserlight, Thanks for your reply. I've ...

    Hi laserlight,

    Thanks for your reply.
    I've

    #include<stdio.h>
    #include<stdlib.h>
    #include<unistd.h>

    #define _GNU_SOURCE
Results 1 to 25 of 87
Page 1 of 4 1 2 3 4