Search:

Type: Posts; User: Pappy1942

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: Rotating Log

    by Pappy1942
    Replies
    4
    Views
    5,671

    linled list??

    Hi,
    Why not a circular linked list of 10 nodes (entry 9 next is a pointer to entry 0) and a pointer (lastentry) to the last entry?

    Then input the next entry to lastentry->next->whatever and...
  2. Replies
    11
    Views
    1,873

    Be Careful

    Hi,

    Just do str[100] = '\0'; ///?????

    This is not a good idea unless you KNOW that at least 101 char's have
    been allocated for the string.

    You might be putting the '\0' in the middle of...
  3. Thread: IF statement

    by Pappy1942
    Replies
    19
    Views
    2,375

    printing 5 digits

    Hi,

    I don't know if this will help but to print 5 digits, even with ints less than 10000, use :

    int num = 0; // can be any number up to 99999
    printf("\nThe number is %05d",num);
  4. Thread: int split...

    by Pappy1942
    Replies
    19
    Views
    2,853

    union

    Why not ??

    union intchar
    {
    short int i;
    char cs[2];
    };
  5. Replies
    2
    Views
    3,142

    Hi, Looking at your string /* Blah2 */ text...

    Hi,

    Looking at your string

    /* Blah2 */ text /* /* Blah */ */

    Shouldn't the output be

    text */
  6. Replies
    11
    Views
    2,215

    Hi, Try the code snippet below in a short...

    Hi,

    Try the code snippet below in a short program.


    unsigned char a;
    char b;

    a = 0xff;
    b = 0xff;
  7. Replies
    5
    Views
    1,085

    Hi, Do you mean something like this? ...

    Hi,

    Do you mean something like this?


    union aryint
    {
    char chrs[4];
    int x;
    };
  8. Replies
    6
    Views
    10,141

    Comparing single char's

    Hi,

    The program below searches for a single char in a string.

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

    int main()
  9. Replies
    5
    Views
    4,509

    Hi, Below is a sample that puts the first four...

    Hi,
    Below is a sample that puts the first four char's form one string into another string.

    #include <stdio.h>
    #include <conio.h>

    int main()
    {
    char *mystr = "this is the input string";
    ...
  10. Replies
    6
    Views
    1,068

    WIN32 programs

    Hi,
    If I'm not mistaken, programs compiled with MSV++6 will not run on "Regular" DOS(ie. DOS 6.22).
    If you want to write programs for DOS try one of the free compilers from Borland. I use Turbo...
  11. Replies
    18
    Views
    2,406

    string??

    Hi,
    Do you mean a string std::string or an array of char's?

    To clear an array of char's so that C sees an empty string just make the first element 0(zero).


    char mystr[20] = "this is a test";...
  12. Prime Factors

    Hi,
    What you seem to be asking is a way to fing the prime factors of
    a number.
    First of all,not all numbers have 2 prime factors. Prime numbers have only themselves.(One is not considered a...
  13. Replies
    2
    Views
    1,050

    Hi, One way is to print a dummy string with all...

    Hi,
    One way is to print a dummy string with all spaces. Then fill the dummy string starting at the right end and printing it again.
    You will have to use gotoxy(...) so the dummy string prints in...
  14. Replies
    16
    Views
    3,493

    createfile

    Hi,
    Look here.

    http://www.cis.upenn.edu/~mcken/pet/portio/ReadMe.html

    Pappy
  15. Replies
    3
    Views
    1,438

    Hi, socket.h is not for windows. Try winsock.h....

    Hi,
    socket.h is not for windows.
    Try winsock.h. Some of the def's are the same as socket.h.
    Hope this helps.
  16. Thread: crazy output

    by Pappy1942
    Replies
    22
    Views
    3,695

    scanf

    Hi,

    Below is a way around the scanf problem. Maybe not the best but it works in both of my 16bit compilers and the free Borland 5.5.

    #include<stdio.h>
    #include <conio.h>

    int main()
    {
    ...
  17. Replies
    6
    Views
    1,880

    Hi, Be aware that different compilers have...

    Hi,
    Be aware that different compilers have different values for RAND_MAX.

    Thus the formula

    x = rand() % 50000 + 1

    may not give a vaule higher than 32,768.
  18. Replies
    2
    Views
    2,106

    Hi, Nowadays many printers will not print in...

    Hi,
    Nowadays many printers will not print in DOS. Before going any further look up your printer on the net to find out if it will print in DOS.
    If not, easiest work around is to print to a file....
  19. Replies
    7
    Views
    3,757

    kbhit and getch

    Hi,
    Try this.

    #include <conio.h>
    #include <stdio.h>
    int main()
    {
    char a;
    while(!kbhit())
    {
  20. Thread: Printer Port

    by Pappy1942
    Replies
    2
    Views
    2,331

    Printer port

    Hi,
    In the good old days of DOS, controlling the printer port was easy. outp(port,byte) would send a byte to the port.
    outp(0x378,byte) sends the byte to the printer port.

    This may or may not...
  21. Replies
    14
    Views
    4,579

    Hi again, Below is code that will give the...

    Hi again,

    Below is code that will give the "digits" base 256 of a base 10 number. Digits is in quotes because it really gives an int from 0 to 255. Since it woulb be difficult to come up with...
  22. Replies
    14
    Views
    4,579

    Confused

    Hi,

    Are you trying to convert 123 base(256) to a decimal number?

    That is

    1 times 256 raised to the 2nd power plus
    2 times 256 rasied to the 1st power plus
    3 times 256 rasied to the 0...
  23. Replies
    18
    Views
    4,388

    Hi, Question 1. No. When you allocate memory...

    Hi,
    Question 1.
    No. When you allocate memory for foobar you get memory for a long int (count) and two pointers to NODE's. No data in that.
    To start the list make head point to memory allocated...
  24. Replies
    2
    Views
    1,513

    Hi, It seems that you have created a pointer to ...

    Hi,
    It seems that you have created a pointer to BankID rather than an instance of a BankID.

    Try

    BankID bankid1;

    /*if you need a pointer then add */

    BankID *bankidp;
  25. Replies
    1
    Views
    1,717

    Memory allocation and lists

    Hi,
    Link lists are used when you don't know how many nodes you are going to have.
    Each time you need a new node you allocate memory ( malloc() etc.) for it. The pointer returned from the allocation...
Results 1 to 25 of 27
Page 1 of 2 1 2