~rabbits/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH left] Save file back to original location

Details
Message ID
<20210108041240.31111-1-zachdecook@librem.one>
DKIM signature
missing
Download raw message
Patch: +7 -3
---
 left.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/left.c b/left.c
index b422d09..effcdb0 100644
--- a/left.c
+++ b/left.c
@@ -28,6 +28,8 @@ int HEIGHT = 8 * (VER + 2) + PAD * 2;
int FPS = 30, GUIDES = 1, ZOOM = 2, DOWN = 0;
int RULER = 60;

char* filename = "example.txt";

/* interface */

Uint32 theme[] = {
@@ -367,10 +369,10 @@ loadtxt(FILE *f)
}

void
savetxt(void)
savetxt()
{
	int i;
	FILE *f = fopen("example.txt", "w");
	FILE *f = fopen(filename, "w");
	for(i = 0; i < text_len; ++i) {
		fputc(text[i], f);
	}
@@ -525,8 +527,10 @@ main(int argc, char *argv[])
	if(!init())
		return error("Init", "Failure");
	loadchr(fopen("type.chr", "r"));
	if(argc > 1)
	if(argc > 1){
		loadtxt(fopen(argv[1], "r"));
		filename = argv[1];
	}
	redraw(pixels);
	while(1) {
		int tick = SDL_GetTicks();
-- 
2.29.2
Reply to thread Export thread (mbox)