hello, i m working on H.264 encoder, i m new to dis and if anyone can suggest me how to code using c code then i m more thankful to them... plz let me know how to open a binary file using c, i have tried and have got zero errors but end result its not opening :(
This code does not work:
First, you meant the assignment operator.
Second, malloc returns void* and this cannot be assigned to a char* uness you use a cast: - buffer = (char*)malloc(s);
Third, this code: - if (fs==NULL)
-
{
-
fseek(fh, 0L, SEEK_END);
-
long s = ftell(fh);
-
rewind(fh);
-
etc...
probably wants to be: - if (fs!=NULL)
-
{
-
fseek(fh, 0L, SEEK_END);
-
long s = ftell(fh);
-
rewind(fh);
-
etc...
because if fs is zero, your file did not open.
I got everything to compile but did not run the code
3 2335
How about posting your code for opening the file?
- #include <stdio.h>
-
#include <stdlib.h>
-
-
int main()
-
{
-
char *buffer ;
-
FILE *fh, *fs ;
-
fh= fopen("display name.c", "rb");
-
-
-
fs= fopen (" loadout.c","w");
-
-
if (fs==NULL)
-
{
-
fseek(fh, 0L, SEEK_END);
-
long s = ftell(fh);
-
rewind(fh);
-
buffer == malloc(s);
-
if ( buffer != NULL )
-
{
-
fread(buffer, s, 1, fh);
-
// we can now close the file
-
fclose(fh); fh = NULL;
-
-
// do something, e.g.
-
fwrite(buffer, s, 1, stdout);
-
-
free(buffer);
-
}
-
if (fh != NULL) fclose(fh);
-
}
-
-
return EXIT_SUCCESS;
-
}
This code does not work:
First, you meant the assignment operator.
Second, malloc returns void* and this cannot be assigned to a char* uness you use a cast: - buffer = (char*)malloc(s);
Third, this code: - if (fs==NULL)
-
{
-
fseek(fh, 0L, SEEK_END);
-
long s = ftell(fh);
-
rewind(fh);
-
etc...
probably wants to be: - if (fs!=NULL)
-
{
-
fseek(fh, 0L, SEEK_END);
-
long s = ftell(fh);
-
rewind(fh);
-
etc...
because if fs is zero, your file did not open.
I got everything to compile but did not run the code
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bishman |
last post by:
Hi,
Can someone suggest the best technique / method of opening a Word ( or any
other ) Document from an SQL BLOB ?
I have the process of saving and retrieveing the file from an SQL Binary...
|
by: rojavenkat81 |
last post by:
Hi All,
Please help me regarding php program for convert video file to .flv file.
I searched in many sites but i got only tool to convert video file to .flv file.But I want convert...
|
by: Pier |
last post by:
there is a method to open and decript a *.dat files?
|
by: Uday |
last post by:
Hi Everybody,
I am building a website in Asp.Net 1.1. I need to
play a video file in the site.
How to do this. Please help me out.
Thanks in Advance
Uday Mandava
|
by: aratimane |
last post by:
Hi,
I have received the video file in chunk and want to join/merge these chunks into one video file.
I have used cat command in unix for joining video, but while played that video file it...
|
by: kirubagari |
last post by:
I Would Like Ask Ques On How To Open Bonding.bin File In C++ Or In Visual Basic 6.actually The Data In The Binary File Have Been Corrupted And I Would Like To Know The Method How To Open The File...
|
by: mindmaster32 |
last post by:
Hi,
I am looking for a python tool or module that helps me build a script
that can perceive object moves in a video file captured by a (web)
camera. My main goal is to be able to count people...
|
by: Amol |
last post by:
Hi ,
I need to grab thumbnails from a video file with extension wmv or dat.
I need to write the code in c#
has anybody done this before.
Any help is appreciated.
Thanks
|
by: William Johnston |
last post by:
Hi,
I get an infinite loop and non-"optimal" results from an MSDN Magazine March 2007 article on creating bitmaps from video files.
The infinite loop and non-"optimal" results are from a...
|
by: sonu |
last post by:
hey good morning ......
how to convert a video file in .flv format in php for linux
hosting......is there any package whis provide this facility .
Can i use ffmpeg for linux hosting...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |