Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.shlink.de!news1.wobline.de!news.bcc.de!newsfeeder.ewetel.de!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!209.197.12.242.MISMATCH!nx01.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!transit4.readnews.com!panix!not-for-mail From: Ruben Safir Newsgroups: comp.os.linux.development.apps Subject: reading a temp file in C++ Date: Tue, 28 Jun 2011 08:33:43 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 40 Message-ID: NNTP-Posting-Host: www2.mrbrklyn.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1309250023 23894 96.57.23.82 (28 Jun 2011 08:33:43 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 28 Jun 2011 08:33:43 +0000 (UTC) User-Agent: Pan/0.133 (House of Butterflies) Xref: x330-a1.tempe.blueboxinc.net comp.os.linux.development.apps:168 any clue why this isn't retrieving the contents of the temp file Question Deck::create_question(WINDOW* menu_win, std::ostream &os ,std::istream &in ){ char default_editor[20000] = "vi "; char * editor; char tmp[4096]; char path[] = "/tmp/fileXXXXXX"; int fd; fd = mkstemp(path); editor = getenv("EDITOR"); if (editor == NULL){ editor = default_editor; } strcat(editor, path); char quest_prompt[] = "Edit Your Question"; .... std::string input_q, input_a; while( ( c=wgetch(quest_win) ) ){ if ( (c == 10) ){ def_prog_mode(); endwin(); system(editor); reset_prog_mode(); __gnu_cxx::stdio_filebuf< char> tmpfile_buf(fd, std::ios::binary|std::ios::app); std::istream is(&tmpfile_buf); is.seekg(0, std::ios::beg); while(is){ is.read( tmp, 4096); std::cerr << "What did we read" << tmp << std::endl; input_q = tmp; } tmpfile_buf.close(); break; } } remove(path);