Questions tagged [cstdio]

A C++ wrapper for C standard IO header stdio.h.

42 questions
1
vote
1 answer

C++: fopen() returns handle to empty file

I'm getting a strange file handle from fopen; the pointer itself isn't NULL, but the file it represents has no size, and feof(file) is already set... what could be causing this? (I triple checked the file itself, it exists, has data, and the file's…
Anne Quinn
  • 10,856
  • 7
  • 40
  • 83
1
vote
2 answers

How to avoid losing data when overwriting a file is interrupted in C

I've written code that saves progress in my game, but one of my biggest fears is the brief window of time during saving when that data might become corrupted should the computer crash or lose power. Is there standard methodology using only C's…
Anne Quinn
  • 10,856
  • 7
  • 40
  • 83
1
vote
2 answers

Rotating two dimensional array of integers

I have a problem with a task for my IT school. The problem is : Turn the frame of an array to left. Input : First get the numbers of tests (t). Then for each test get l and k (line and column), 3 <= l, k <= 100. Then fill the matrix with numbers…
Setzo
  • 39
  • 1
  • 7
1
vote
1 answer

cstdio fopen and fclose not working correctly on osx

I'm using tinyxml through openframeworks which uses cstdio for file access. I can see the example program quite happily create and write files but there is no delete so my plan is to implement remove, but after trying to run this code in my own…
cool mr croc
  • 743
  • 1
  • 13
  • 31
1
vote
1 answer

Inplace edit of a file using cstdio?

I have a file that I'm writing data to, using the functions in cstdio. I want to make sure the file has successfully been written to file without any interruptions, so I know what to expect from the file when I later read from it. The way I aim to…
Anne Quinn
  • 10,856
  • 7
  • 40
  • 83
0
votes
0 answers

getting cstdio errors despite it not being included? (Visual Studio)

I'm trying to compile a C program in Visual Studio 2019, I have 'Compile As' set to 'Compile as C Code (/TC)' and cstdio is not included anywhere in my project, yet it still gives me cstdio errors C:\Program Files (x86)\Microsoft Visual…
BBQGiraffe
  • 47
  • 8
0
votes
0 answers

Proper way to use standard c++ printf() function as interface to custom library to print to a character display

First, some background. I have acquired a few of these Avago HCMS-29xx LED displays. there is an Arduino library for controlling them, but I want to use a raspberry pi. So I have forked the original library's GitHub and started porting. The library…
u6bkep
  • 1
0
votes
3 answers

How to use gets() in cpp

These days I am learning strings and arrays in cpp. In my school they taught us to take a string as user input, one have to use gets() but it isn't working on any of the compilers I have. I have already tried using cstdio library, still errors. I…
meispi
  • 43
  • 2
  • 6
0
votes
1 answer

Unable to use double variable in C++ using cstdio

C++ code for double using cstdio header. #include using namespace std; int main() { double f; scanf("%lf",&f); printf("%lf",f); return 0; } This code always…
GIRISH kuniyal
  • 515
  • 4
  • 12
0
votes
2 answers

I am not able to understand why output is coming 10 in this for loop

can anybody clear my doubt .. why this program is giving 10 as output. can you please explain the mechanism .. for loop is also having ; before the statements also #include using namespace std; int main() { int i ; for ( i =0 ;…
0
votes
0 answers

Header for CStdioFile , if I am already including windows.h

Which header shall i use for CStdioFile? The relevant doc is here when I try including afx.h , i get following error( window.h is included before afx.h because of some other function): Error 1 error C1189: #error : WINDOWS.H already included. …
alabama1
  • 11
  • 3
0
votes
2 answers

Multiple inputs in C

I'm trying to create a function that gets multiple inputs for resistances value. In my main function the program asks the user to ask how many resistors are needed. The number of resistors needed by the user will become the number of times the…
0
votes
0 answers

Error while trying to store .ppm image data

While trying to store the image data for a .ppm file I trip an error that says: Unhandled exception at 0x01071712 in Map.exe: 0xC0000005: Access violation writing location 0x0bf13746. I assume this means its writing to some part of memory that…
0
votes
2 answers

Not understanding the C format specifiers when using fscanf()

So I am reading a text file in this format: ABC 51.555 31.555 DEF 23.445 45.345 I am trying to use fscanf() to parse the data, because this file could grow or shrink it needs to be dynamic in the way it loads hence why i used malloc and i also want…
Definity
  • 640
  • 1
  • 6
  • 26
0
votes
1 answer

No console output in simple c++ program

I noticed a weird behaviour of some of my programs in c++ and when I was trying to figure out what coused it, I found out, that something wrong is going on with my console outputs. I used iostream and cstdio functions with the same behaviour. When I…
fifco
  • 11
  • 4