C fputc and fgetc vs C++ read and write Programming Software Development by Micko …;name", "wb"); while ( (buff = fgetc(fp1)) != EOF) { fputc(buff, fp2); } } [/code] I'm wondering how this is done… Re: C fputc and fgetc vs C++ read and write Programming Software Development by Micko … sure about text and binary mode. In C implementation with fputc and fgetc I opened files in binary mode, so I… Re: C fputc and fgetc vs C++ read and write Programming Software Development by Ancient Dragon only write out the number of bytes read. At some point (at end-of-file) the number of bytes read will be less than the buffer size. This would go much faster if you read/write with larger buffer size -- say 255 characters. [code] int main() { [color=red] char buf[255];[/color] ifstream fp_in("my.txt", ios_base::binary | … Re: C fputc and fgetc vs C++ read and write Programming Software Development by Narue >copying from one file to another is a simple matter. On the surface at least. >I'm wondering how this is done in C++ A direct translation of C streams to C++ streams is: [code] #include <fstream> int main() { ifstream in ( "infile" ); ofstream out ( "outfile" ); if ( in && out ) { … Re: C fputc and fgetc vs C++ read and write Programming Software Development by Narue >I was thinking about get and put, but I wasn't sure about text and binary mode It doesn't matter in this case. Re: Question with fput Programming Software Development by Narue fputc writes a single character to the specified string. If you want to convert an integer to a string and then write it to your file, fprintf would be the easiest: [code] fprintf(fp, "%d\t%s\n", temp.number, temp.description); [/code] help with files Programming Software Development by edenn1 …) return; c = fgetc(currErr); while (c != EOF){ fputc(c,newErrFile); c = fgetc(currErr); } fclose(newErrFile); fclose(…) return; c = fgetc(from); while (c != EOF){ fputc(c,to); c = fgetc(from); } fclose(from); fclose(… extract includes Programming Software Development by Adami …: if (ch=='/') { state = LEFT_SLASH; } else { fputc(ch,c1_fp); if (ch=='\"') state = IN_STRING; }… if (ch=='/') { state = IN_CPP_COM; } else { fputc('/',c1_fp); fputc(ch,c1_fp); state = OUT; } break; /*LEFT_SLASH*/ case… Re: extract includes Programming Software Development by Adami …OUT: if (ch=='/') { state = LEFT_SLASH; } else { fputc(ch,c1_fp); if (ch=='\"') state = IN_STRING; } …else if (ch=='/') { state = IN_CPP_COM; } else { fputc('/',c1_fp); fputc(ch,c1_fp); state = OUT; } break; /*LEFT_SLASH*/ case … Re: extract includes Programming Software Development by Adami …OUT: if (ch=='/') { state = LEFT_SLASH; } else { fputc(ch,c1_fp); if (ch=='\"') state = IN_STRING; } …else if (ch=='/') { state = IN_CPP_COM; } else { fputc('/',c1_fp); fputc(ch,c1_fp); state = OUT; } break; /*LEFT_SLASH*/ case … Main arguments (options structure) Programming Software Development by hust921 …++) { if (curChar == CRYPT_ALPHA[i]) fputc(ALPHA[i], fpOUT); } if (curChar == '\n') fputc('\n', fpOUT); if (curChar == '\t') fputc('\t', fpOUT); } } void wrongUse() { printf… Pre Processor imitation Programming Software Development by Adami … case OUT: if (ch=='/') state = LEFT_SLASH; else { fputc(ch,new_fd); if (ch=='\"') state = IN_STRING; } … else if (ch=='/') state = IN_CPP_COM; else { fputc('/',new_fd); fputc(ch,new_fd); state = OUT; } break; /*LEFT_SLASH… Re: extract includes Programming Software Development by Adami …header file content to *.c2 file*/ { ch=fgetc(header_fp); fputc(ch,c2_fp); }/*while(4)*/ fclose(header_fp); } }/*frst if*/ else… { fputc(ch,c2_fp); } ch=fgetc(c1_fp); }/*while(1)*/ fclose(c1_fp… Re: extract includes Programming Software Development by Adami …*.c2 file*/ { ch=fgetc(header_fp); fputc(ch,c2_fp); }/*while(4)*/ fclose(header_fp); …} }/*frst if*/ else { fputc(ch,c2_fp); } ch=fgetc(c1_fp); }/*… Re: Main arguments (options structure) Programming Software Development by hust921 …curChar == '\n') // Finding \n and inserting with \n fputc('\n', fpOUT); if (curChar == '\t') // Finding \t… and inserting with \t fputc('\t', fpOUT); } } void replaceOriginal(char *inFileName, char … Re: Main arguments (options structure) Programming Software Development by hust921 …curChar == '\n') // Finding \n and inserting with \n fputc('\n', fpOUT); if (curChar == '\t') // Finding \t… and inserting with \t fputc('\t', fpOUT); } } void replaceOriginal(char *inFileName, char … Calling functions with variable parameters Programming Software Development by VernonDozier … 1st unnamed arg */ for (p = message; *p; p++) { if (*p != '%') { fputc((int) *p, debugFile); continue; } switch (*++p) { case 'd': ival = va_arg… Copy file to file needs help! Programming Software Development by Rmitboy …+"); do { if(c != '\n') { char_per_line++; fputc(c, fw); }else{ fputc(c,fw); //rewind(fw); //fputc(char_per_line, fw); char_per_line = 0; } }while((c = fgetc… Question with fput Programming Software Development by chained …; (arr->size); i++){ temp = arr[[i]; fputc(((&temp)->number, filePtr); fputc('/t', filePtr); fputs(((&temp)->descrip), filePtr…); fputc(('/n', filePtr); } }[/CODE] Unfortunately, the integer is not apparent. I … Re: Logical Error in code for file manipulation Programming Software Development by Perry31 …text.Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); fclose(fw); } void append(char *fn) ….Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); fclose(fw); } [/CODE] The problems …text.Press 0 to exit\n"); while((ch=getchar())!='*') fputc(ch,fw); fclose(fw); } int append(char *fn… Need Help combining programs into one Programming Software Development by gallantmon1 … if(doc=='\n') goto out; } } } out: fputc(doc, output); } fclose(input); fclose(output); return 0…if(doc=='\n') goto out; } } } out: fputc(doc, nocw); } //Breakdown while(!feof(noc)) { fscanf… Intializer in C ? Programming Software Development by tvisha …[state_sequence[i]][state_sequence[i+1]]; itoa(output,&output_ch,2); fputc(output_ch,op); } } fclose(fp); fclose(op); printf("\nfile closed…,2); printf("Output : %d %c\n",output,output_ch); fputc(output_ch,op); for(i=0;i<=19;i++) { if… [Cry for Help]Getting individual words from a File - FIFO help[/Cry For Help] Programming Software Development by Krysis …;a"); fputs(s, ofile); fputc('\n', ofile); fclose(ofile); }…fputs(out, ofile); fputc('\n', ofile); fclose… File pointers Programming Software Development by lecotti …];counter1++){ /*eneter each character from the array into the file*/ fputc(file_text[counter1], input_file); } } printf("\nFile sucessfully read.\n… too many */ for(;file_text[counter1];counter1--){ if(counter1 != 0){ fputc(file_text[counter1], output_file); /*output each character to the file individually… Eliminate Numbers Programming Software Development by mukund_yk …(Numbered)) != EOF ) { if(c == '\n') { putchar(c);// Put a \n //fputc(c, Filtered); if((c = fgetc(Numbered)) == EOF) return 0; while…' && c <= '9' ) { c = fgetc(Numbered); } } putchar(c); //fputc(c, Filtered); } fclose(Numbered); fclose(Filtered); return 0; }[/CODE] Its… Setting up serial port\ hyperterminal problem Programming Software Development by schaffino … and character to stack to be used by fputc push ebx call DWORD PTR(fputc) add esp,8 //scrub the parameters from… Errors in code for transmitter. Programming Software Development by amateur¬ …, DWORD PTR(portptr) push eax push eax call DWORD PTR (fputc) ; send char to COM port add esp,8 jmp more… eax,FEND ; send terminating sentinal push eax call DWORD PTR (fputc) add esp,8 mov eax, DWORD PTR (fileptr) push eax… Logical Error in code for file manipulation Programming Software Development by indrajeet6 … the text.Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); fclose(fw); } void append(char *fn) { FILE *fw… the text.Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); fclose(fw); } [/CODE] The problems are 1)When… Re: Logical Error in code for file manipulation Programming Software Development by vinitmittal2008 … the text.Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); printf("\n\n File successfully written!"… the text.Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); printf("\n\n File successfully appended!"… Re: Logical Error in code for file manipulation Programming Software Development by Perry31 … the text.Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); printf("\n\n File successfully written!"… the text.Press * to exit\n"); while((ch=getche())!='*') fputc(ch,fw); printf("\n\n File successfully appended!"…