A C++ wrapper for C standard IO header stdio.h.
Questions tagged [cstdio]
42 questions
0
votes
1 answer
Clarification on fsetpos, C++
I am a little confused with function fsetpos in the stdio.h library. I want to be to write to different indexes (i.e do not want to write to a file contiguously) in a file. I was considering using fsetpos however the documentation states..
The…
![](../../users/profiles/4024983.webp)
Rstack
- 45
- 9
0
votes
0 answers
c4droid: Makefile and cstudio
I´m doing some tests with c4droid on my phone (a galaxy s3 mini).
Compiling using "g++ + Bionic", no have problems.
However, when i use a Makefile, the "cstdio" library don´t recognize. ("cstdio": no such file or directory)
I dont know i can include…
![](../../users/profiles/3786450.webp)
user3786450
- 23
- 2
0
votes
2 answers
sscanf string format specifiers not works for '\t'
#include
#include
#include
char *tokenstring = "first,25.5,second,15";
int result, i;
double fp;
char o[10], f[10], s[10], t[10];
void main()
{
result = sscanf(tokenstring, "%[^','],%[^','],%[^','],%s", o, s, t, f);
…
![](../../users/profiles/1433066.webp)
Nick Dong
- 3,111
- 6
- 39
- 68
0
votes
2 answers
Flush Input Buffer C
Note: fflush(stdin) did not work.
Problem:
I'm entering numbers in as a while loop using scanf (inb4 depreciated). When I enter one, the buffer fills the rest in with blank lines.
Code:
double input, total;
for(i=0; i
![](../../users/profiles/3124409.webp)
Goodies
- 3,526
- 2
- 22
- 45
0
votes
1 answer
C FILE* read/write and optional create
I'm attempting to open a file which may or may not exist for read and write access. I'll also need to perform seek operations on this file. The issue I'm having is that the "r" file flag requires that the file exist, the "w" flag discards the…
![](../../users/profiles/1529591.webp)
fredbaba
- 1,326
- 1
- 14
- 24
0
votes
3 answers
How do right read file via stdio? C++
I want to read file via stdio for RapidXML. I used following:
#include
#include
#include
#include
using namespace rapidxml;
int main(int argc, char** argv)
{
FILE *pFile;
pFile =…
![](../../users/profiles/3054731.webp)
Ivan
- 882
- 9
- 20
-1
votes
1 answer
Edit txt file using library from C
I am facing problems scanning an existing file.
The challenge is that I have a source text file with some strings. I have to scan this file for the word "o'clock", and where I find it, I have to take the word before "o'clock" and enclose it in…
![](../../users/profiles/14736951.webp)
Dsyder
- 13
- 2
-1
votes
3 answers
Difference between %u and %d in scanf()
In C++, if I read an integer from a string, it seems it does not really matter whether I use u or d as conversion specifier as both accept even negative integers.
#include
using namespace std;
int main() {
int u, d;
sscanf("-2",…
![](../../users/profiles/2157640.webp)
Palec
- 10,298
- 7
- 52
- 116
-2
votes
1 answer
my program suddenly exiting when it gets to the `cin.getline()` function
I wrote a program using the getline() function.
code
I think the problem is in this part:
int encrypt(){
int opt,limit;
char inp[100],enc[100];
cout<<"Choose the encryption type\n"
<<"[1]Simple\n"
<<"[2]complex\n"
…
![](../../users/profiles/12730998.webp)
Nived.R.S
- 17
- 3
-2
votes
1 answer
c++ Working with Command Line Arguments.. isalpha not working and how to concat together
Hello I'm making a program to display the following if say './prog7x hello there ' was entered as command line argument:
argument 0 is "./prog7x", has length 8, contains 5 alphabetic characters
argument 1 is "hello", has length 5, contains 5…
![](../../users/profiles/7170351.webp)
alpacaness
- 21
- 1
-3
votes
2 answers
What is fflush exactly and what does it do?
I was reading http://www.cplusplus.com/reference/cstdio/fflush/ and I was curious about what it means. According to the website it says:
If the given stream was open for writing (or if it was open for updating and the last i/o operation was an…
![](../../users/profiles/3650742.webp)
Storm
- 17
- 3
-4
votes
1 answer
should I mix C & C++ style I/O in my C++ program?
This question confuses me lot. Because C++ is a superset of C programmer is free to use C's library functions like printf(), scanf() & many others etc. But I usually like C++ 's Object oriented I/O system & I mostly like to use cout & cin. Because…
![](../../users/profiles/3777958.webp)
Destructor
- 13,235
- 8
- 48
- 108