How do you go back a space when writing to a file?

Here's the do you go back a space in the file you are writing to?  When i do

fputc("\b", fpTextOut);  

all that happens is a box gets outputted in the file, but what i want to do is go back a space and write over the previously written text in the file being written to.....

It's not a hard question....please give syntax in the answer. Thanks!
Who is Participating?
niemeyerConnect With a Mentor Commented:
You could consider my comment as an answer. But no problems... if it's better for you if I submit an answer... here it is! :-)

Thank you!

That's occurring because your command really insert the char '\b' into the file. You have to move the file pointer back...

itssookAuthor Commented:
hey neimeyer,

that's right, it worked! Answer the question to get your points!
Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

you can give him points even if he didn't answer.
just click beside his comment
it say "accept comment as answer" or something like this.
>fputc("\b", fpTextOut);  

This will insert the \b character in your file, as niemeyer said.  However, when your file is interpreted (i.e. dumped to the screen), the \b character may actually incite a backspace and the output would reflect this.

However, if you want to remove the char from the actual file, niemeyer's solution is what you want.
/* Assume file name to be read is "file.dat"
 * Assume contents of "file.dat" is (below)
 * 12345
 * Output of program execution is shown below
 * 12
 * File contents now would be
 * 1n345
 * Written to solve your problem
 * Hope it will helps

#include <stdio.h>

void main()
    FILE *fp;
    char input;
    char replace='n';

    if ( (fp = fopen("file.dat","r+b")) == NULL )  /* open file as binary file */
        printf("Error in opening file.\n");
    else { /* file position now at 1st position */
        input = getc(fp); /* file position now at 2nd position after reading */
        input = getc(fp); /* file position now at 3rd position after reading */
        fseek(fp,-1,SEEK_CUR);   /* move file position back to 2nd position */
        fputc(replace,fp);   /* write the replace char to current position */
Hi hongjun!!

I'm missing something or I've already answered this question 7 hours before you?

People here is very smart...  :-)
itssookAuthor Commented:
neimeyer answered first if hee propesed an answer i'd give him the points
No offence neimeyer. I only trying to help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.