Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

coding help

chweetychweety Posts: 1Member
Hello,

Can anyone help me out to code a c/c++ program to reverse content of file without temp file
&
A code to swap higher bytes and lower bytes in integer variable

Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    : Hello,
    :
    : Can anyone help me out to code a c/c++ program to reverse content of
    : file without temp file
    : &
    : A code to swap higher bytes and lower bytes in integer variable

    Yes we can help you but will not write the code for you. That's your job, not ours.

    To reverse a file I would read the whole file into memory then write it back out in reverse order. Do you want to do it in C or C++ (yes, there is a difference).

    To swap bytes: several ways to do it. (1) use shift operator, (2) use union, (3) copy the original int binary value to a char buffer then copy back again in reverse order.
    =============================================
    never lie -- the government doesn't like the competition. (Author unknown)
  • webcrawlerwebcrawler Posts: 12Member
    : : Hello,
    : :
    : : Can anyone help me out to code a c/c++ program to reverse content of
    : : file without temp file
    : : &
    : : A code to swap higher bytes and lower bytes in integer variable
    :
    : Yes we can help you but will not write the code for you. That's
    : your job, not ours.
    :
    : To reverse a file I would read the whole file into memory then write
    : it back out in reverse order. Do you want to do it in C or C++
    : (yes, there is a difference).
    :
    : To swap bytes: several ways to do it. (1) use shift operator, (2)
    : use union, (3) copy the original int binary value to a char buffer
    : then copy back again in reverse order.
    : =============================================
    : never lie -- the government doesn't like the competition. (Author
    : unknown)

    you could also use fseek(file, SEEK_END) and read each line backwards, then ouput.
  • stoberstober Posts: 9,765Member ✭✭✭
    : : : Hello,
    : : :
    : : : Can anyone help me out to code a c/c++ program to reverse content of
    : : : file without temp file
    : : : &
    : : : A code to swap higher bytes and lower bytes in integer variable
    : :
    : : Yes we can help you but will not write the code for you. That's
    : : your job, not ours.
    : :
    : : To reverse a file I would read the whole file into memory then write
    : : it back out in reverse order. Do you want to do it in C or C++
    : : (yes, there is a difference).
    : :
    : : To swap bytes: several ways to do it. (1) use shift operator, (2)
    : : use union, (3) copy the original int binary value to a char buffer
    : : then copy back again in reverse order.
    : : =============================================
    : : never lie -- the government doesn't like the competition. (Author
    : : unknown)
    :
    : you could also use fseek(file, SEEK_END) and read each line
    : backwards, then ouput.
    :

    that will not change the contents of the file only display it backwards. It will work if that is what OP wants to do.

    =============================================
    never lie -- the government doesn't like the competition. (Author unknown)
  • red3warlordred3warlord Posts: 77Member
    : : : : Hello,
    : : : :
    : : : : Can anyone help me out to code a c/c++ program to reverse content of
    : : : : file without temp file
    : : : : &
    : : : : A code to swap higher bytes and lower bytes in integer variable
    : : :
    : : : Yes we can help you but will not write the code for you. That's
    : : : your job, not ours.
    : : :
    : : : To reverse a file I would read the whole file into memory then write
    : : : it back out in reverse order. Do you want to do it in C or C++
    : : : (yes, there is a difference).
    : : :
    : : : To swap bytes: several ways to do it. (1) use shift operator, (2)
    : : : use union, (3) copy the original int binary value to a char buffer
    : : : then copy back again in reverse order.
    : : : =============================================
    : : : never lie -- the government doesn't like the competition. (Author
    : : : unknown)
    : :
    : : you could also use fseek(file, SEEK_END) and read each line
    : : backwards, then ouput.
    : :
    :
    : that will not change the contents of the file only display it
    : backwards. It will work if that is what OP wants to do.
    :
    : =============================================
    : never lie -- the government doesn't like the competition. (Author
    : unknown)

    hi to you...

    seems like you have a big problem, am i right?

    and that is y ou don't persue yourself to study for it...

    you have to focus on it so that you will get what you want to attain...

    i can give you not the code,
    but a prob that will force you to persue on it...

    i hope this will help you to make yourself be active in terms of
    persuation and networking, and at the same time, brainstorming and creativity.....

    this wold be the prob:

    a teacher has difficult time in computing the average grade of her 5 students, namely Joseph, Marvin, Antonio, Louis, and Mark. There average
    grade will be computed by this format:

    average grade = (FirstGrade + SecondGrade + ThirdGrade + FourthGrade) / 4

    Make a program that can compute the average grade of each student of the teacher.



    from red3warlord with gratitude always saying...



    "never lie on the present
    and make focus for the future..."
Sign In or Register to comment.