online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdio.h> int main() { char line[256]; FILE* input = fopen("input.txt", "r"); if(!input) { printf("could not open input.txt for read"); } else { FILE* output = fopen("output.txt", "w"); if(!output) { printf("could not open output.txt for write"); } else { while (fgets(line, sizeof(line), input)) { /* note that fgets don't strip the terminating \n, checking its presence would allow to handle lines longer that sizeof(line) */ fprintf(output, "%s", line); } fclose(output); } fclose(input); } FILE* test = fopen("output.txt", "r"); if(!test) { printf("could not open output.txt for read"); } else { while (fgets(line, sizeof(line), test)) { /* note that fgets don't strip the terminating \n, checking its presence would allow to handle lines longer that sizeof(line) */ printf("%s", line); } fclose(test); } return 0; }
1 2 3 4

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue