473,840 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

converting from file pointer to character pointer

2 New Member
hi all,
i am studying engg,i have problem that ,how can i convet from the file pointer to character pointer or character array.in my project i cant use file pointer,i need to convert file pointer as a character pointer.please help me in this regard,

thank u advance
Jul 30 '07 #1
3 2969
9,208 Recognized Expert Moderator Expert
Do you have a code sample where you are stuck?
Jul 30 '07 #2
2 New Member

this is my code where i have stuck the thing is i cant use any FILE pointers in my project and iam in need of any alternative char pointer or char array.
The following part is the code i want to alter

Expand|Select|Wrap|Line Numbers
  1.  #ifdef _CHECK_BITS_
  2. FILE *fpe;
  3. #endif
  4.  TextureObjectLayer_enc(FILTER *wvtfilter, SOL_PARAMETERS *vm_param)
  5. {
  6.   FILE *bitfile;
  7.   int  texture_object_id=0;
  8. char fname[100];
  9.   int  texture_object_layer_shape =vm_param->sa_dwt;
  10. init_bit_packing_fp(bitfile,1);
  11.  if ((bitfile=fopen(fname,"wb"))==NULL)
  12.         errorHandler("Can't open file '%s' for writing.",fname);
  13. #ifdef _CHECK_BITS_
  14.  fpe=fopen("encode_bits","w");
  15. #endif
  16. }
  19. void init_bit_packing_fp(FILE *fp,int clearByte)
  20. {
  22.     byte_count=0;
  23.     count=0;
  24.     bitfile=fp;
  25.     bytes_in_buffer=bitrate=huff_put_buffer=huff_put_bits=bit_buf=0;
  27.     //clean byte pointer only when asked for
  28.     if(clearByte == 0)
  29.        fseek(bitfile,-(buffer_length-byte_ptr+((bit_num+1)/8)),SEEK_CUR);
  32.     buffer_length=byte_ptr=0;
  33.     bit_num=-1;
  35. }
Thanks in advance for your reply.
Jul 31 '07 #3
9,208 Recognized Expert Moderator Expert
From what I can surmise, the problem is on this line:
fseek(bitfile,-(buffer_length-byte_ptr+((bit_ num+1)/8)),SEEK_CUR);
your byte_ptr needs to be an int and not a pointer.

When working with fseek, you are always calculating an offset and that offset is always an interger value. That is, all of your calculations are relative to the beginning, current position , or end of the file. There is no addressing involved.
Jul 31 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Roy Rodsson via .NET 247 | last post by:
Hi all! I am using a stored procedure in SQL2000 for retrieving fileinformations from a db. the table as an uniqueidentifier for the file information. The stored procedure has a variable called fileIds that is oftype varchar. I am putting in a comma separated string with ids (such as:'9B176B0C-CA03-49C9-A2E7-063038E7CF20','9B176B0C-CA03-49C9-A2E7-063038E7CF22','9B176B0C-CA03-49C9-A2E7-063038E7CF23') However, when I execute the sp via...
by: AMT2K5 | last post by:
Would it not be more efficient to take in a void pointer? int number = 30; fout.write((char *)(&number), sizeof(number));
by: Jamiil | last post by:
How do I get the length of a character pointer? TIA
by: sheroork | last post by:
Can anyone help me in getting to understand pointer to pointer with examples? Appritiate in advance. Sagar
by: Kavya | last post by:
Since Circle is-a Shape we are allowed to do this Circle *c = new Circle; Shape *s = c; //Works But we can't do this Circle **cc = &c; Shape **ss = cc; //Does not works
by: eagerlearner | last post by:
I know what is pointer, but I always blurred by character pointer to string. Can you tell me these accordingly ? Thanks. What is the difference ? char string = "abc"; // between this one and char * string = "abc"; How come ? This one work const char * get() {
by: bipinskulkarni | last post by:
Hi, i have a field createdby with datatype GUID. In following query ,i encountered with the error "Conversion failed when converting from a character string to uniqueidentifier" select ISNULL(VW_tbl_ChildProducts.createdBy,' ' ) as createdBy from table.
by: SnehaAgrawal | last post by:
Hi I get the error "Syntax error converting datetime from character string "for the following sql statement in Stored proc. SET @dynamicSQL =N'SELECT CUSTID,SHCodeLink FROM AccountMaster where CONVERT(DATETIME,OPDATE,105) < = '''+CONVERT(DATETIME,@ACCYEAR,105) +''' And GLCode = '+@DIVGLCODE EXEC(@dynamicsql)
by: lakshmishivakumar | last post by:
how to pass character pointer from tcl to c through interface file using swig?
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.