User Profile

Collapse

Profile Sidebar

Collapse
puneetsardana88
puneetsardana88
Last Activity: Mar 1 '12, 08:42 PM
Joined: Aug 3 '09
Location: India
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Hi

    I am using Code Block IDE with Mingw Compiler on Windows XP 32 bit. I am working on small project in which we are reading from text file. We were doing some processing based on ASCII value of those characters. Now requirement has changed, the file may contain letters from other languages also,which is not there in ASCII. So I just need a way to read those characters from file and get their UNICODE so that we can continue processing...
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    started a topic Reading unicode characters from file in C
    in C

    Reading unicode characters from file in C

    Hi

    I need to read Unicode characters from a file. The only thing I need to do from them is to extract their Unicode number.

    For example if file has ΓΌ I need to extract its corresponding Unicode number.


    Please help.

    Thanks
    See more | Go to post

  • puneetsardana88
    replied to Random number generation
    in C
    Yes I am looking for a method in which I can generate randon numbers without using sleep. (with sleep i can pass different seed) but i am looking for an alternative to sleep so that performance do not deter
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    started a topic Random number generation
    in C

    Random number generation

    Hi

    I am generating 256 bit key for AES. I am using the following implementation

    Code:
    void fill_random_key(char *key)
    {
        /* Length of the key */
        unsigned short int length = KEYLENGTH;
    
        /* Seed number for rand() */
        srand((unsigned int) time(0) + getpid());
        int i=0;
    
        while(length--) {
            key[i]=rand() % 127;
    ...
    See more | Go to post

  • puneetsardana88
    replied to Implementing generic stack
    in C
    Thank You Donbock. I think I need to make my own function that will check the string for integer float or character.
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    replied to about fflush function.
    in C
    fflush

    If stream points to an output stream or an update stream in which the most recent operation was not input, the fflush() function causes any unwritten data for that stream to be written to the file, and the st_ctime and st_mtime fields of the underlying file are marked for update.

    If stream is a null pointer, the fflush() function performs this flushing action on all output or update streams in which the most recent...
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    started a topic Implementing generic stack
    in C

    Implementing generic stack

    Hi

    Currently I am implementing a generic(int plus float etc) stack in C. However I am facing some problems.

    stackgen.h
    Code:
    #define STACKSIZE 100
    #define INTEGER 1
    #define FLOAT 2
    #define STRING 3
    struct stackelement
     {
         int etype;
         union
          {
              int i;
              float f;
          }element;
     };
    struct stack
    ...
    See more | Go to post

  • puneetsardana88
    replied to General protection fault/stack fault
    in C
    @ rusty uts

    The code that I posted works fine for me. I am running in code block mingw compiler. Please check
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    replied to Structure offset
    in C
    I have got the above from Internet. The above is also giving error. Can you elaborate more on this with detailed explanation?
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    replied to General protection fault/stack fault
    in C
    Code:
        #include<stdio.h>
        #include<conio.h>
        #include<string.h>
        main()
        {
            struct boy
            {
                char name[100];
                int marks;
            };
            struct boy a[100];
            int no,i,l,m,k,t;
            char nam[100];
            printf("Enter no of students");
            scanf("%d", &no);
    ...
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    replied to General protection fault/stack fault
    in C
    For the second question you are forgetting to add & while inputting

    Code:
                printf("Enter pages");
                scanf("%d", &b[i].pages);
                printf("Enter Book Number");
                scanf("%d", &b[i].no);
    This works fine....
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    started a topic Structure offset
    in C

    Structure offset

    Hi

    I want to find offset of structure elements

    Code:
    struct
    {
      char a;
      int b;
      char c;
    }example;
    Code (which i found on books and internet) to find offset is

    Code:
    unsigned int offset;
    offset = (unsigned int)(&(((example *)(0))->b));
    I am not able to understand the above code. What is significance of 0 here?...
    See more | Go to post

  • puneetsardana88
    started a topic Array using stack
    in C

    Array using stack

    Consider a language that does not have arrays but does have
    stacks as a data type.and PUSH POP..are all defined .Show
    how a one dimensional array can be implemented by using two
    stacks.

    I am unable to solve this. Can somebody tell me whats the approach one should follow? I dnt need the code, only approch will suffice.
    See more | Go to post

  • Replacing break and continue with structured equivalent

    Hi

    Is there any way by which we can replace break and continue with structured equivalent.

    We can cause loop continuation test to fail but break exits immediately from the point it is encountered so the statements after it are not executed.

    Eg

    int i=1,j;
    for(j=0;j<10;j+ +)
    {
    break;
    i++;
    }

    I can replace this as
    ...
    See more | Go to post

  • puneetsardana88
    replied to Problem while reading through socket
    in C
    Thank You Banfa. I got your point. Thanks a lot. Will keep this in mind.
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    started a topic Problem while reading through socket
    in C

    Problem while reading through socket

    Hi

    I am developing a chat server program.
    I am not able to get client name from this line

    read(connfd,inf o[j].name,MAXLINE);

    When i remove read(connfd,no, 3);
    It is reading name.. Can somebody solve my problem. I need both. Please help

    ///////////server
    Code:
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <string.h>
    ...
    See more | Go to post
    Last edited by Niheel; Jun 11 '11, 08:19 PM.

  • puneetsardana88
    started a topic How to connect application to internet?

    How to connect application to internet?

    Hi

    I am building a project on C# based on share market but few problems i am facing

    How will i connect my application to Internet?

    We want to put stocks of BSE so how will i get stock quotes of BSE in my application which is being updated every second?

    Please help, thanks in advance.
    See more | Go to post

  • puneetsardana88
    replied to Problem Multiple definition of enum
    in C
    got the answer

    it should be

    #ifndef NODE_H
    #define NODE_H

    Many Thanks to all
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    replied to Problem Multiple definition of enum
    in C
    @Redson

    It worked earlier with same names

    @banfa

    I copy pasted the code(of yours) it still gave same error...Now what i did

    Code:
    #ifndef SIZE_GRAPH
    #define SIZE_NEIGHBOURS 10
    #define SIZE_GRAPH 100
    #include<iostream>
    enum STATUS{ready=0,waiting=1,processed=2};
    class Node
     {
         public:
         char info;
         int distance;
    ...
    See more | Go to post

    Leave a comment:


  • puneetsardana88
    started a topic Problem Multiple definition of enum
    in C

    Problem Multiple definition of enum

    Hi

    I was implementing BFS and DFS

    So I have three class stack,queue,nod e and main class

    I have put Node class in Node.h

    Code:
    #define SIZE_NEIGHBOURS 10
    #define SIZE_GRAPH 100
    #include<iostream>
    enum STATUS{ready=0,waiting=1,processed=2};
    class Node
     {
         public:
         char info;
         int distance;
          STATUS node_status;
    ...
    See more | Go to post
No activity results to display
Show More
Working...