User Profile

Collapse

Profile Sidebar

Collapse
AmmarN
AmmarN
Last Activity: Apr 12 '07, 04:44 PM
Joined: Mar 23 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • AmmarN
    replied to Invalid conversion from int to enum
    in C
    THANK YOU VERY MUCH BANFA!!
    I REALLY REALLY APPRECIATE YOUR HELP AND TIME. This site and you people are simply amazing.
    Thanks again and yes it does work....
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to Invalid conversion from int to enum
    in C
    Thank you very much all for your time and help. I got it figured out the exact same way you suggested. Its just that I didnot wanna declare the enum outside of the struct. I thought if i could find something that would do it without haveing to define the enum first outside of the struct. But it seems like thats the only way. Thanks once again for your time and help.

    You guys are great....
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to Invalid conversion from int to enum
    in C
    Hey ,

    It still doesnot work, I named the unions and the enum and then tried the same code to cast the value, but it still gives the same error.
    Thanks....
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to Invalid conversion from int to enum
    in C
    Thanks alot for your reply,i tried it with the static_cast but i always get an error in the same line where i use the static_cast.
    for ex:
    Code:
    array[0].u2.iS = static_cast<iS>(1);
    Error:

    error: syntax error before `>' token

    Is there any other way to get this solved. I am working on a code that was written in C , i can access the value of this enum when i try to print it e.g
    ...
    See more | Go to post

    Leave a comment:


  • AmmarN
    started a topic Invalid conversion from int to enum
    in C

    Invalid conversion from int to enum

    HI All;

    I am having a problem changing the value of an enum. I have a struct as shown below:

    Code:
      typedef struct
      {
      union 
         { long lV; volatile char c[8]; } u1;
      
      union 
      {
        enum  { CDR_RESET, CDR_ON, CDR_DISARMED } iS;
        volatile char c[8] } u2;
     } cdr_t;
    Now i have an array of this struct say:

    cdr_t array[4];...
    See more | Go to post

  • AmmarN
    replied to How to convert a short into 2 chars.
    in C
    Thank you very much for your help.i got it figured out.I will post my solution here anyways just incase some one else looks for it in the future.

    short value = (some value);
    char a;
    char b;

    a=value; // to copy the first 8 bits.
    value = value>>8; //push the other 8 bits to the right
    b=value;...
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to How to convert a short into 2 chars.
    in C
    Thanks for your reply. I know thats what I need to use but i dont know how.
    I would really appreciate if you could explain that.
    Thanks....
    See more | Go to post

    Leave a comment:


  • AmmarN
    started a topic How to convert a short into 2 chars.
    in C

    How to convert a short into 2 chars.

    I would like to convert a short in to 2 chars. Since short is 2 bytes i would like to isolate them and convert them into 2 chars.

    Any suggestions would be appreciated.
    Thanks in advance.
    See more | Go to post

  • AmmarN
    replied to How to call functions from the command line
    in C
    THANK YOU VERY MUCH FOR YOUR TIME AND VALUABLE HELP.I got this working. I do have another little question though.

    I would like to convert a short in to 2 chars. Since short is 2 bytes i would like to isolate them and convert them into 2 chars.

    Any suggestions would be appreciated.
    Thanks in advance....
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to How to call functions from the command line
    in C
    Thanks for your reply. I have made the correction that you mentioned but it works either way. Like I mentioned before, its acting very weird, sometimes say if Function A is called it would execute say Function X. Totally random. I cant see a problem with the code or maybe something is wrong with the string comparison. You help is very appreciated. Thank you....
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to How to call functions from the command line
    in C
    Thanks for your code it was very helpfull. Since i have too many commands that the user can call therefore i am not in a position to show the menu everytime or assign a number to every command. What i was thinking , if i could write something that would allow the user to enter the name of the command every time the previous process is done. I have tried doing this using the following code. But its crashing randomnly, it works sometimes but other...
    See more | Go to post
    Last edited by horace1; Mar 28 '07, 04:57 PM. Reason: use code tags

    Leave a comment:


  • AmmarN
    replied to How to call functions from the command line
    in C
    Thanks for your reply. Actually the programme will execute the task and then wait for another command. I will try to explain it alittle better this time.Its a Store point binary file that I am trying to show the contents of. My programme is like a editor or a viewer that explains what every byte in that file means. I already know what is the format of the file and how it is created. based on that knowledge i have created my prgramme to show the contents...
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to How to call functions from the command line
    in C
    It will be run from the terminal window and i wont run any other prgrams from that window until i quit this program. I hope this makes it clear.Thanks...
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to How to call functions from the command line
    in C
    I am using linux suse.
    I will start the programme from the command line .
    The programme will display information in the command line window.

    Once again thank you very mcuh for your help and time. I appreciate it alot....
    See more | Go to post

    Leave a comment:


  • AmmarN
    replied to How to call functions from the command line
    in C
    Thanks for your response. Actually its a bit more complicated than that. This is a utility that intakes a binary file and then performs different tasks on it based on what the user decides to do with it, moreover when the user would call a certain action (function) he would also specify many parameters for that function e.g he may wanna specify the range of words he would like to see . I already have all the functions written and the programme is...
    See more | Go to post

    Leave a comment:


  • AmmarN
    started a topic How to call functions from the command line
    in C

    How to call functions from the command line

    Hi all,

    I have a c++ programme that intakes a binary file and performs various operations on it. I am not gonna get in to the details of the operations, currently i specify the order in which the operations take place by calling different functions the way i write the main function. My question is -- Is there a way that a user can call different functions from this application from the command line.
    For example.

    ...
    See more | Go to post

  • AmmarN
    replied to Need help in C++ command line operations
    in C
    Thank you for your reply.

    You are right i actually would like to call the functions while the programme is running and i understand that i wont be able to do anything else at the command line while the prograame is running. Its an application so i wanna run the programme first and then call different functions while the programme is running such as:

    a.out Open (filename)
    a.out CallF1 (x,y,z)
    (after F1...
    See more | Go to post

    Leave a comment:


  • AmmarN
    started a topic Need help in C++ command line operations
    in C

    Need help in C++ command line operations

    Hi all,

    I have a c++ programme that intakes a binary file and performs various operations on it. I am not gonna get in to the details of the operations, currently i specify the order in which the operations take place by calling different functions the way i write the main function. My question is -- Is there a way that a user can call different functions from this application from the command line.
    For example.

    ...
    See more | Go to post
No activity results to display
Show More
Working...