User Profile

Collapse

Profile Sidebar

Collapse
sathishc58
sathishc58
Last Activity: Oct 17 '10, 01:16 PM
Joined: Sep 5 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • sathishc58
    started a topic How to compare strings using awk?
    in C

    How to compare strings using awk?

    Hi All,

    I have the following text file and I want to display only the lines where "Vacancy" field (or column) is set to "YES".

    $ cat movielist
    [Showtimes],[Movie Title],[Vacancy]
    1300 2Oct,X-files,Yes
    1600 2Oct,Xmen,No
    1700 2Oct,Spiderman, Yes

    Code:
          1 show_file()
          2 {
          3     echo "Show file is called";
    ...
    See more | Go to post

  • How to connect to MS-Access using C (I am using Cygwin)

    Dear All,

    I want to connect to MS-Access using C. I am using cygwin. Those who dont know about cygwin, it is just an emulator of linux supports cc/gcc/CC and g++.

    Please avoid giving link to VC++, C#.

    I have three fields in MS-Access. FName, LName and City

    I want to insert some values from my "C" program.

    I searched net but I was able to find only links to VC++...
    See more | Go to post

  • sathishc58
    started a topic Need help on sempahore & semaphore set?
    in C

    Need help on sempahore & semaphore set?

    Hi All,

    I started preparing on ipcs mechanisms. There are many tutorials and examples available in net for shared memory and semaphores.

    My requirement is I have to lock a shared memory segment using semaphore. Before I implement the program I wanted to get a better idea.

    Question:- Can anyone explain in which case we would use "single semaphore" and "semaphore set".
    ...
    See more | Go to post

  • sathishc58
    started a topic Why do we need self-referential structure?
    in C

    Why do we need self-referential structure?

    Hi All,

    We know what is self-referential structure and it is widely used in creating data structure (for ex: linked-list)

    struct xxx
    {
    int a;
    struct xxx *ptr;
    }

    Why should I declare "ptr" to be of the same type. Cannot I declare "ptr" as "int" or "void" as it is going to store only the address.

    I searched net,...
    See more | Go to post

  • sathishc58
    started a topic Doubt related to ptr-to-ptr
    in C

    Doubt related to ptr-to-ptr

    Hi All,

    This is a sample program for pointer-to-pointer memory allocation and program works well.

    Code:
    #include <stdio.h>
    
    int main()
    {
        char  a[5][5] = {"One", "Two", "Thr", "four", "Five" };
        char  **b;
        int   i, j;
    
        //b = (char **) malloc(5 * sizeof(a[0]));
        b = (char **) malloc(20);
    ...
    See more | Go to post

  • sathishc58
    replied to Please explain why the program seg fault?
    in C
    Dear Banfa,

    Thanks for your reply. Could you please let me know the suggestion/answer as how argv[] in main() behaves.

    Because argv[] would be declared with NULL dimension always if I am not wrong. I wrote the program by keeping argv[] in mind.


    Thanks & Regards
    Sathish Kumar
    See more | Go to post

    Leave a comment:


  • sathishc58
    started a topic Please explain why the program seg fault?
    in C

    Please explain why the program seg fault?

    Hi All,

    I tried to understand the reason for core dump but I could not get the reason. Could anyone help me to figure out the issue.

    Code:
         1  #include <stdio.h> 
         2  #include <string.h> 
         3  #include <malloc.h> 
         4 
         5  int main() 
         6  { 
         7      int   i; 
         8      char *ptr[];   --> If dimension is given then the
    ...
    See more | Go to post

  • sathishc58
    started a topic Doubts related to C/C++
    in C

    Doubts related to C/C++

    Hi All,

    Could anybody answer for the following queries?

    1) How addition/subtraction of two different objects is possible in C without operator overloading? Here "int" and "float" could be taken as two different objects. (Not sure whether my understanding is correct)

    2) I have given a simple structure which is used to construct a linked list.
    struct a
    {
    char...
    See more | Go to post

  • sathishc58
    started a topic Doubt related to free()
    in C

    Doubt related to free()

    Hi All
    I have a question related to free().

    For example
    A(char *buffer) call B(char *buffer)
    B(char *buffer) in turn calls C(char *buffer)
    C(char *buffer) in turn calls D(char *buffer)
    D(char *buffer) in turn calls E(char *buffer)
    and so on.........
    I pass a pointer as a parameter from A()
    A(char *buffer);
    1) This buffer was freed somewhere in some function. (Deallocation could...
    See more | Go to post

  • sathishc58
    started a topic How to find unused macros in our program?
    in C

    How to find unused macros in our program?

    Hi All

    I have a simple program

    #define DUMMY_MACRO 10

    main()
    {
    int a;
    }

    When I execute lint check for the above file it states

    variable "a" is unused.

    Likewise is there any way to find out the macros which were used not used in our file

    Thanks & Regards
    Sathish Kumar
    See more | Go to post

  • Please explain the behaviour of strlen() in the program

    Hi All

    Please explain why strlen returns() "16" as output here and explain the o/p for sizeof() as well

    main()
    {
    char a[3]={'a','b','c'};
    printf("strlen= %d\n", strlen(a));
    printf("sizeof= %d\n", sizeof(a));
    printf("%d %d", strlen(a),sizeo f a);
    }


    Output


    strlen=16
    sizeof=3
    16 3...
    See more | Go to post

  • sathishc58
    started a topic Please explain why sizeof behaves like this?
    in C

    Please explain why sizeof behaves like this?

    Hi All

    #include <stdio.h>
    #include <string.h>

    #define SYSTEM_TABLE "SYSIBM"

    int main()
    {
    printf("size is %d %d\n", sizeof(SYSTEM_T ABLE - 1), (sizeof(SYSTEM_ TABLE) - 1) );
    }

    Output

    size is 4 6

    I can understand the reason for the seconds value i.e. 6.

    Please explain the reason for the...
    See more | Go to post

  • Please clear this doubt relating to Forest (DataStructures)

    Hi All

    I recently studied about "Forest" Datastructures.

    Supposed we have two trees. Could not represent diagramatically

    Tree a
    ======
    1) 10 is the root node
    2) 9 is the

    Tree a Tree b
    ===== =====
    ...
    See more | Go to post

  • Difference between Circular Linked list and Loop in linked list

    Hi

    Can anyone explain me the difference between circular linked list and looped linked list?

    1) In Circular linked list Next part of last node will be pointing to the first nodes starting address.

    2) What is meant by loop then?

    Thanks & Regards
    Sathish Kumar
    See more | Go to post

  • sathishc58
    started a topic Please explain me about unsigned char?
    in C

    Please explain me about unsigned char?

    Hi All

    I dont have much idea about unsigned char. I know only the range of the unsigned char i.e 0 to 255.

    I want to copy this long data into a unsigned char array

    unsigned long a=59128808

    unsigned char b[20];

    I want to copy using only memcpy and not through sprintf. I dont mind creating a pointer to long and then copying to array.

    I tried to copy but I was...
    See more | Go to post

  • sathishc58
    started a topic WIll this program cause any memory leak?
    in C

    WIll this program cause any memory leak?

    Hi All

    Please review the program and let me know whether my program will cause memory leak or not.

    1 #include <stdio.h>
    2
    3 struct emp
    4 {
    5 int empno;
    6 char empname[10];
    7 } obj;
    8
    9
    10 void copy(struct emp *);
    11 void freeStruct(stru ct emp);
    12
    13 main()...
    See more | Go to post

  • Compilation error when attempting to initalize int **ptr[][]

    HI All

    I tried out this program to know the difference between pointer-to-pointer and 2D Arrays. I compiled it using C++ compiler.


    main()
    {
    int **ptr=new ptr[10][10];
    }

    "ptr3.c", line 3: Error: Type name expected instead of "ptr".
    "ptr3.c", line 3: Error: Cannot use int(*)[10] to initialize int**.
    2 Error(s) detected.
    ...
    See more | Go to post

  • Why the following program generates segmentation fault?

    Hi All

    The below tries to fetch the details of the group to which I belongs to. But due to some reason it seg faults.

    #include <grp.h>
    #include <stdio.h>

    main()
    {
    gid_t gid;
    struct group *grp;
    grp=getgrgid(gi d);
    printf("reached \n");
    printf("GroupId %d\n", grp->gr_gid);
    printf("GroupNa me %s\n",...
    See more | Go to post

  • sathishc58
    replied to Hi All What is meant by decaying of array?
    in C
    Hi

    Can you explain this sentence clearly? "Arrays are composed of a type but have no type". I am not that much clear.

    Thanks & Regards
    Sathish Kumar...
    See more | Go to post

    Leave a comment:


  • sathishc58
    started a topic Hi All What is meant by decaying of array?
    in C

    Hi All What is meant by decaying of array?

    Hi All

    I have a very basic idea decaying of array. Can anyone clearly explain what it actually does? Or any good URL could be of great use.


    Thanks & Regards
    Sathish Kumar
    See more | Go to post
No activity results to display
Show More
Working...